-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrontab
25 lines (21 loc) · 1.15 KB
/
crontab
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
PATH=/bin:/usr/bin:/usr/local/bin
SHELL=/bin/bash
# Change this to your mta bustime api key
BUSTIME_API_KEY=
# Change this to your Postgres DB name
PGHOST=
PGDATABASE=
# By default the Google Cloud bucket will have the same name as the db.
GOOGLE_BUCKET=mta-bus-archive
S3BUCKET=nycbuspositions
# Change this to match where you put your file
GOOGLE_APPLICATION_CREDENTIALS=$HOME/mta-bus-archive/client_secret.json
*/2 * * * * make -e -C $HOME/mta-bus-archive positions > /dev/null
*/2 * * * * make -e -C $HOME/mta-bus-archive tripupdates > /dev/null
*/3 * * * * make -e -C $HOME/mta-bus-archive alerts > /dev/null
5 6 * * * make -e -C $HOME/mta-bus-archive s3 clean-date MODE=upload DATE=$(date +\%Y-\%m-\%d -d yesterday)
1 1 * * * psql -c "delete from rt.vehicle_positions p where p.timestamp < now()-interval '1 month'"
1 2 * * * psql -c "delete from rt.trip_updates t where t.timestamp < now()-interval '1 month'"
1 3 * * * psql -c "delete from rt.messages m where m.timestamp < now() - interval '1 month'"
1 4 * * * psql -c "delete from rt.alerts a where a.start < now() - interval '1 month'"
1 2 * * * find $HOME/mta-bus-archive/csv -type f -mtime +30 -delete