univ-pau-ics/build/service/main.sh

49 lines
1.5 KiB
Bash
Raw Normal View History

2017-09-12 07:49:38 +00:00
#!/bin/bash
# Absolute root dir
ABSROOT=$( dirname $(realpath $0) );
# [1] Download the list of Diplomes
#========================================================#
# (1) Get the diplomes list #
wget http://sciences.univ-pau.fr/edt/_ressource.js -qO $ABSROOT/../../tmp/cursus.js && echo "* downloaded successfully" || echo "* download failed" || exit 1;
# (2) Get Period list #
wget http://sciences.univ-pau.fr/edt/_periode.js -qO $ABSROOT/../../tmp/period.js && echo "* downloaded successfully" || echo "* download failed" || exit 1;
# [2] Parse these lists
#========================================================#
# (1) Parse the diplomes list #
php $ABSROOT/lib/parse.php cursus $ABSROOT/../../tmp/cursus.js && echo "* parsed successfully" || echo "* parsing failed" || exit 1;
# (2) Parse the period list #
php $ABSROOT/lib/parse.php period $ABSROOT/../../tmp/period.js && echo "* parsed successfully" || echo "* parsing failed" || exit 1;
# [3] Update ICS files
#========================================================#
# (1) Create ICS files #
php $ABSROOT/lib/update.php;
# (2) Remove buffer data #
rm -r $ABSROOT/../../tmp/*.ics
# [X] Remove downloaded original files
#========================================================#
# (1) Remove cursus #
rm $ABSROOT/../../tmp/cursus.js && echo "* removed successfully" || echo "* removing failed" || exit 1;
# (2) Remove period #
rm $ABSROOT/../../tmp/period.js && echo "* removed successfully" || echo "* removing failed" || exit 1;