scripts: add optional support for "timeout"; allow site-updater to be called directly

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.
This commit is contained in:
kytv
2014-02-13 22:13:21 +00:00
parent 9d60201506
commit 90047161cb
2 changed files with 11 additions and 3 deletions

View File

@@ -1,3 +1,10 @@
MTNURL=127.0.0.1:8998
MTNBRANCH=i2p.www
TOUCHFILE=/tmp/2fcd2f17-c293-4f77-b4c9-9b266ba70daa
TIMEOUT="20m"
if [ $(which timeout) ]; then
MTN="timeout $TIMEOUT mtn"
else
MTN="mtn"
fi