Skip to content

Commit

Permalink
Update update script
Browse files Browse the repository at this point in the history
  • Loading branch information
d4n1elchen committed Nov 15, 2018
1 parent c4c4e6f commit 58f7927
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pages/update_pages.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash
timeout 1m python -u get_all.py
timeout 1m python2 -u get_all.py
RET=$?
if [ $RET -gt 0 ] && [ $RET != 124 ]; then
exit $RET
fi

while [ "$(<retry.json)" != "[]" ]; do
echo "Execution timeout, retry ..."
timeout 1m python -u get_all.py retry
timeout 1m python2 -u get_all.py retry
if [ $RET -gt 0 ] && [ $RET != 124 ]; then
exit $RET
fi
done
6 changes: 6 additions & 0 deletions update_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ BASEDIR=$(pwd)
LOGDIR=${1:-$BASEDIR/log}
LOGFILE=$LOGDIR/update.log

echo -n "Start to fetch all course page ... "
(time bash -c "cd $BASEDIR/pages && ./update_pages.sh | $BASEDIR/predate.sh >> $LOGFILE && cd ..") 2>&1 | $BASEDIR/predate.sh >> $LOGFILE
echo "Finish"

echo -n "Start to update course ... "
node run | $BASEDIR/predate.sh >> $LOGFILE
echo "Finish"

echo "" | $BASEDIR/predate.sh >> $LOGFILE

TOC=$((`date +%s`-TIC))
Expand Down

0 comments on commit 58f7927

Please sign in to comment.