This repository has been archived by the owner on May 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcronjob
executable file
·124 lines (83 loc) · 2.44 KB
/
cronjob
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/perl
chdir "/home/govtrack/scripts/gather";
require "general.pl";
require "persondb.pl";
require "db.pl";
@A = @ARGV;
undef @ARGV;
my $today = DateToDBString(time);
my $session = SessionFromDateTime($today);
print `date`;
GovDBOpen();
&TestIsWeekly;
$OUTPUT_ERRORS_ONLY = 1;
if ($A[0] eq "EARLYGATHER") { DoEarlyGather(); }
if ($A[0] eq "" || $A[0] eq "GATHER") { DoNoonGather(); }
if ($A[0] eq "" || $A[0] eq "INDEX") { DoIndex(); }
if ($A[0] eq "EMAILS") { DoEmails(); }
print "$HTTP_BYTES_FETCHED bytes fetched.\n";
print `date`;
DBClose();
# Touch the website to force the cache to clear.
system("touch ../../website/style/master.xsl");
sub DoEarlyGather {
# Update any bills whose THOMAS summary changed.
require "parse_status.pl";
UpdateBills($session);
RefreshBills($session, "not(starts-with(\@updated, '${today}T')) and count(subjects/*)=0");
# Get roll call votes
DownloadRollCallVotesAll(undef, 1, 1, 1);
require "parse_committeeschedule.pl";
FetchCommitteeSchedule();
require "fetchbilltext.pl";
GetBillFullText($session);
CreateGeneratedBillTexts($session);
}
sub DoNoonGather {
DoEarlyGather();
#require "parse_record.pl";
#GetCR('s', $retdate, 1);
#GetCR('h', $retdate, 1);
require "fetchcbo.pl";
GetCBO();
require "fetchomb.pl";
#GetOMB($retdate);
#require "technorati.pl";
#ScanTechnorati();
#system("perl googlesitemap.pl");
#system("perl congresspedia.pl > /dev/null");
}
sub DoIndex {
# INDEXES
# NEW STATS
system("python ../analysis/sponsorshipanalysis.py $session");
# REP STATS
print "RepStats\n";
require "repstat.pl";
DoRepStats($session);
print "Done RepStats\n";
# SUMMARY
print "StatsSummary\n";
require "statsummary.pl";
DoStatsSummary($session);
system("perl repstat-vimg.pl $session");
# LUCENE
print "Lucene\n";
system("sh lucene.sh $session");
require "getpopularmonitors.pl";
GetPopularMonitors();
require "indexusc.pl";
IndexBillsUSC($session);
system('mysql -u govtrack_sandbox govtrack -Be "SELECT DISTINCT value FROM billindex WHERE idx = \"crs\"" > /home/govtrack/data/us/crs_terms');
system('tail -10000000 ~/logs/access_log |perl access_log_smarts.pl');
print `date`;
}
sub DoEmails {
my $bin = "cd ../../website/bin; /usr/bin/mono GovTrackEmailUpdates.exe";
system("$bin daily");
if ($Weekly) { system("$bin weekly"); }
}
sub TestIsWeekly {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$Weekly = ($wday == 0);
}