]> code.communitydata.science - covid19.git/blobdiff - cron-wikipedia_views.sh
changes to allow historical view data collection
[covid19.git] / cron-wikipedia_views.sh
index ec3d4ec0ae1bb0dda79e33f2a7a411632d741843..4afe380ee1a75902e5e019061924c52dee6d4c78 100644 (file)
@@ -1,16 +1,16 @@
 #!/bin/bash -x
 
 TZ="UTC"
-date_string=$(date +%Y%m%d)
+date_string=${OVERRIDE_DATE_STRING:-$(date +%Y%m%d)}
 
-./wikipedia/scripts/wikiproject_scraper.py 2> >(tee wikipedia/logs/enwp-wikiproject_scraper-${date_string}.log)
+view_log="enwp-daily_views-${date_string}.log"
+./wikipedia/scripts/wikiproject_scraper.py 2> >(tee wikipedia/logs/${view_log})
 
 # get the list of files
-view_log="enwp-daily_views-${date_string}.log"
-./wikipedia/scripts/fetch_enwiki_daily_views.py 2> >(tee wikipedia/logs/${view_log})
-cp wikipedia/logs/${view_log} /var/www/covid19/wikipedia/logs/${view_log}
-cp wikipedia/data/digobs_covid19-wikipedia-enwiki_dailyviews-${date_string}.tsv /var/www/covid19/wikipedia/
+./wikipedia/scripts/fetch_enwiki_daily_views.py -d "${date_string}" 2> >(tee -a wikipedia/logs/${view_log})
+mv wikipedia/logs/${view_log} /var/www/covid19/wikipedia/logs/${view_log}
+mv wikipedia/data/digobs_covid19-wikipedia-enwiki_dailyviews-${date_string}.tsv /var/www/covid19/wikipedia/
 
 # xz wikipedia/data/digobs_covid19-wikipedia-enwiki_dailyviews-${date_string}.json
-cp wikipedia/data/digobs_covid19-wikipedia-enwiki_dailyviews-${date_string}.json /var/www/covid19/wikipedia/
+mv wikipedia/data/digobs_covid19-wikipedia-enwiki_dailyviews-${date_string}.json /var/www/covid19/wikipedia/
 

Community Data Science Collective || Want to submit a patch?