trap "rm -fr state $SGMONTMP" HUP PIPE INT QUIT TERM EXIT
while : ; do
- [ -s max-attempts ] && read max_attempts < max-attempts || max_attempts=1
+ [ -s max-attempts ] && read max_attempts < max-attempts || max_attempts=$ATTEMPTS_DEFAULT
[ -s state/attempts ] && read attempts < state/attempts || attempts=0
[ -x run ] && cmd=./run || cmd="sh -e run"
if $cmd >state/stdout 2>state/stderr ; then