To this end, I would like to write the script
. Logger.sh
. Continuance.sh
CONTINUANCE=$(continuance $(basename $0))
for f in ...
do
if [ -e $CONTINUANCE ]
then
info Processing $f
...
else
warn Process discontinued before completion
exit 1
fi
done
or. Logger.sh
. Continuance.sh
C=$(continuance $(basename $0))
while [ -e $CONTINUANCE ]
do
...
done
if [ ! -e $CONTINUANCE ]
then
warn Process discontinued before completion
fi
Where the call to "continuance" creates a temporary file, sets up a HUP trap to delete the file, and prints the instructions2008-08-11 13:58:26 INFO To discontinue processing send "kill -HUP 31788" or remove the file /tmp/u-continuance-ITexo31793The function is very simple
function continuance {
f=$(mktemp -p /tmp $1-continuance-XXXXXXXXXX)
trap "rm -f $f" HUP
info To discontinue processing send \"kill -HUP $$\" or remove the file $f
echo $f
}