Add cronjob to fetch new timetable data from HSL

This commit is contained in:
Jan Tuomi
2017-01-20 15:07:26 +02:00
parent 332928ce30
commit 81a7f0a4a4
7 changed files with 51 additions and 25 deletions
Executable
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
echo "Adding cron entries..."
# write out current crontab
crontab -l > temp_crontab
# echo new cron into cron file
printf "*/5 * * * * source $PWD/../virtualenv.sikweb/bin/activate && python $PWD/manage.py hsl &>$PWD/logs/fetch_hsl.log\n\n" >> temp_crontab
# install new cron file
crontab temp_crontab
rm temp_crontab
echo "Done. View your crontab with 'crontab -l' and edit it with 'crontab -e'."