forked from I2P_Developers/i2p.www

Sometimes the mtn syncs hang until aborted. Well, my syncing with welterde and echelon would hang periodically until I added the same timeout support I'm adding here. In short, if Montone's action has not completed within 20 minutes, forcably kill the process. /usr/bin/timeout is a part of coreutils so most (all?) Linux distributions should have it but I don't require timeout to exist. If "timeout" can be found, it'll be used. Also, set site-updater.sh to change to the directory in which the script is located. This way one can give an absolute path in a cronjob. Both of these changes should be low risk.
21 lines
526 B
Bash
Executable File
21 lines
526 B
Bash
Executable File
#!/bin/sh -x
|
|
cd $(dirname $0)
|
|
. ./etc/update.vars
|
|
|
|
TMP=$(mktemp XXXXXXXXXX)
|
|
trap 'rm -f $TMP;exit' 0 1 2 15
|
|
|
|
$MTN pull "mtn://$MTNURL?$MTNBRANCH"
|
|
$MTN up 2>&1 | tee $TMP
|
|
|
|
|
|
if grep "^mtn: \(add\|patch\|dropp\|updat\)\(ed\|ing\) 'i2p2www/translations/" "$TMP" >/dev/null ; then
|
|
echo "Translations updated, compiling messages"
|
|
./compile-messages.sh
|
|
fi
|
|
|
|
if grep "^mtn: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TMP" >/dev/null ; then
|
|
echo "Python files changed, restarting server"
|
|
touch $TOUCHFILE
|
|
fi
|