add timeout support
Sometimes the syncs hang; therefore, let's add a configurable timeout. If the sync doesn't complete in $DURATION, kill the mtn process.
This commit is contained in:
12
mtn/sync.sh
12
mtn/sync.sh
@ -87,6 +87,18 @@ retry ()
|
||||
done
|
||||
}
|
||||
|
||||
# How long to wait for syncs to complete?
|
||||
# TIMEOUT is a floating point number with an optional suffix:
|
||||
# `s' for seconds (the default), `m' for minutes, `h' for hours or `d' for days.
|
||||
# See man timeout(1) for more info.
|
||||
|
||||
TIMEOUT="20m"
|
||||
if [ $(which timeout) ]; then
|
||||
MTN="timeout $TIMEOUT mtn"
|
||||
else
|
||||
MTN="mtn"
|
||||
fi
|
||||
|
||||
##########################################################
|
||||
# Configure as necessary #
|
||||
# Have to be careful to quote the branch $BR correctly #
|
||||
|
Reference in New Issue
Block a user