Pause: temporarily stop processing

This commit is contained in:
Vincent Riquer 2013-09-28 00:12:38 +02:00
parent 00dd038f7b
commit a3ef61551b

41
atom
View File

@ -594,11 +594,29 @@ do
[qQ])
quit=1
;;
[pP])
if (( pause ))
then
pause=0
((
pausedtime +=
$(date +%s) - pausestart
))
concurrencychange=$(date +%s)
else
pause=1
pausestart=$(date +%s)
(( concurrency = maxload / 2 ))
(( concurrency )) || concurrency=1
fi
;;
esac
fi
read humanload garbage < /proc/loadavg
load=${humanload%.*}
if [ -z "$quit" ] && (( $(date +%s)-concurrencychange >= loadinterval ))
if [ -z "$quit" ] \
&& (( ! pause )) \
&& (( $(date +%s)-concurrencychange >= loadinterval ))
then
if (( concurrency > 1 )) \
&& (( load > maxload ))
@ -613,12 +631,18 @@ do
fi
checkworkers
cleaner
master
(( pause )) || master
if (( ran - failed ))
then
currenttime=$(date +%s)
if (( pause ))
then
(( runtime = pausestart - starttime - pausedtime ))
else
(( runtime = currenttime - starttime - pausedtime ))
fi
avgduration=$((
((currenttime - starttime) * 1000)
( runtime * 1000)
/
( ran - failed )
))
@ -673,12 +697,21 @@ do
${minutes:-0} \
${seconds:-0} \
${avgdsec:-0}.${avgdmsec:-0}
if (( pause ))
then
if (( active ))
then
echo -n ' | (pause)'
else
echo -n ' | PAUSED'
fi
fi
done
unset count
endtime=$(date +%s)
(( elapsedseconds = endtime - starttime ))
(( elapsedseconds = endtime - starttime - pausedtime ))
(( days =
elapsedseconds
/