]> code.communitydata.science - covid19.git/commitdiff
add two small shellscripts for automation
authorBenjamin Mako Hill <mako@atdot.cc>
Wed, 1 Apr 2020 20:15:11 +0000 (15:15 -0500)
committerBenjamin Mako Hill <mako@atdot.cc>
Wed, 1 Apr 2020 20:15:11 +0000 (15:15 -0500)
- Added two bash scripts usable as cronjobs to automate the production
  of revisions and view data.

These commands automate the process of running code and copying material

cron-wikipedia_revisions.sh [new file with mode: 0644]
cron-wikipedia_views.sh [new file with mode: 0644]

diff --git a/cron-wikipedia_revisions.sh b/cron-wikipedia_revisions.sh
new file mode 100644 (file)
index 0000000..71ee752
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash -x
+
+TZ="UTC"
+date_string=$(date +%Y%m%d)
+
+./wikipedia/scripts/wikiproject_scraper.py 2> >(tee wikipedia/logs/enwp-wikiproject_scraper-${date_string}.log)
+
+revs_log="enwp-revisions-${date_string}.log"
+./wikipedia/scripts/fetch_enwiki_revisions.py 2> >(tee wikipedia/logs/${rev_log})
+cp wikipedia/logs/${rev_log} /var/www/covid19/wikipedia/logs/
+
+revs_tsv="digobs_covid19-wikipedia-enwiki_revisions-${date_string}.tsv"
+cp wikipedia/data/${revs_tsv} /var/www/covid19/wikipedia
+
+revs_json="digobs_covid19-wikipedia-enwiki_revisions-${date_string}.json"
+xz wikipedia/data/${revs_json}
+cp wikipedia/data/${revs_json}.xz /var/www/covid19/wikipedia
diff --git a/cron-wikipedia_views.sh b/cron-wikipedia_views.sh
new file mode 100644 (file)
index 0000000..ec3d4ec
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash -x
+
+TZ="UTC"
+date_string=$(date +%Y%m%d)
+
+./wikipedia/scripts/wikiproject_scraper.py 2> >(tee wikipedia/logs/enwp-wikiproject_scraper-${date_string}.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/
+
+# 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/
+

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