Page MenuHomePhabricator
Paste P4569

CentralNotice monitoring script
ActivePublic

Authored by Ejegg on Dec 5 2016, 7:02 PM.
#!/bin/bash
export DISPLAY=:0 # needed for phantomjs
fname=`date -u +%Y%m%d%H%M`
for lang in cs de en es # cs and es were unaffected, de and en were affected
do
mkdir -p ~/cndebug/$lang/choiceData/
mkdir -p ~/cndebug/$lang/modvers/
mkdir -p ~/cndebug/$lang/phantom/
curl "https://$lang.wikipedia.org/w/load.php?modules=ext.centralNotice.choiceData" > ~/cndebug/$lang/choiceData/$fname
curl "https://$lang.wikipedia.org/w/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=vector" | tr -d '\n' | egrep -o 'loader.register.*?;;' | sed -e 's/loader.register.//' -e 's/.;;//' | jq '.[][0:2]|@csv' > ~/cndebug/$lang/modvers/$fname
phantomjs --local-storage-path=/tmp/ --load-images=false ~/src/js/phantomjs/loadWikiPage.js $lang > ~/cndebug/$lang/phantom/$fname
done
# in crontab, I run it with
# */5 * * * * /home/elliott/bin/checkCN.sh