-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync.sh
executable file
·28 lines (21 loc) · 919 Bytes
/
sync.sh
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
26
27
28
ROOTDIR="$(readlink -f $(dirname $0))"
APP="/var/www/wikiconvention/wikiconvention-schedule-app"
META="https://meta.wikimedia.org/w/api.php?action=parse&format=json&text=%7B%7B%3AWikiConvention+francophone%2F2018%2FProgramme%7Cshow%3DSimple%7D%7D&prop=text&contentmodel=wikitext"
TMP="${ROOTDIR}/tmp/json"
mkdir -p ${TMP}
git -C ${APP} pull
d=`date`
python3 ${ROOTDIR}/scheduleSync.py ${META} > ${TMP}/sync.json
sed -n '1p' < ${TMP}/sync.json > ${APP}/sessions.json
sed -n '2p' < ${TMP}/sync.json > ${APP}/tags.json
sed -n '3p' < ${TMP}/sync.json > ${APP}/themes.json
CHANGED=$(git -C ${APP} diff --name-only HEAD --)
if [ -n "$CHANGED" ]; then
sed -i "2s/.*/# revision - $d/" ${APP}/schedule.appcache
git -C ${APP} add sessions.json tags.json themes.json schedule.appcache
git -C ${APP} commit -m "Synchronisation $d"
#git -C ${APP} push
echo "$d - SYNCHED"
else
echo "$d - NOCHANGE"
fi