Pause: temporarily stop processing
This commit is contained in:
parent
00dd038f7b
commit
a3ef61551b
41
atom
41
atom
@ -594,11 +594,29 @@ do
|
|||||||
[qQ])
|
[qQ])
|
||||||
quit=1
|
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
|
esac
|
||||||
fi
|
fi
|
||||||
read humanload garbage < /proc/loadavg
|
read humanload garbage < /proc/loadavg
|
||||||
load=${humanload%.*}
|
load=${humanload%.*}
|
||||||
if [ -z "$quit" ] && (( $(date +%s)-concurrencychange >= loadinterval ))
|
if [ -z "$quit" ] \
|
||||||
|
&& (( ! pause )) \
|
||||||
|
&& (( $(date +%s)-concurrencychange >= loadinterval ))
|
||||||
then
|
then
|
||||||
if (( concurrency > 1 )) \
|
if (( concurrency > 1 )) \
|
||||||
&& (( load > maxload ))
|
&& (( load > maxload ))
|
||||||
@ -613,12 +631,18 @@ do
|
|||||||
fi
|
fi
|
||||||
checkworkers
|
checkworkers
|
||||||
cleaner
|
cleaner
|
||||||
master
|
(( pause )) || master
|
||||||
if (( ran - failed ))
|
if (( ran - failed ))
|
||||||
then
|
then
|
||||||
currenttime=$(date +%s)
|
currenttime=$(date +%s)
|
||||||
|
if (( pause ))
|
||||||
|
then
|
||||||
|
(( runtime = pausestart - starttime - pausedtime ))
|
||||||
|
else
|
||||||
|
(( runtime = currenttime - starttime - pausedtime ))
|
||||||
|
fi
|
||||||
avgduration=$((
|
avgduration=$((
|
||||||
((currenttime - starttime) * 1000)
|
( runtime * 1000)
|
||||||
/
|
/
|
||||||
( ran - failed )
|
( ran - failed )
|
||||||
))
|
))
|
||||||
@ -673,12 +697,21 @@ do
|
|||||||
${minutes:-0} \
|
${minutes:-0} \
|
||||||
${seconds:-0} \
|
${seconds:-0} \
|
||||||
${avgdsec:-0}.${avgdmsec:-0}
|
${avgdsec:-0}.${avgdmsec:-0}
|
||||||
|
if (( pause ))
|
||||||
|
then
|
||||||
|
if (( active ))
|
||||||
|
then
|
||||||
|
echo -n ' | (pause)'
|
||||||
|
else
|
||||||
|
echo -n ' | PAUSED'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
unset count
|
unset count
|
||||||
|
|
||||||
endtime=$(date +%s)
|
endtime=$(date +%s)
|
||||||
|
|
||||||
(( elapsedseconds = endtime - starttime ))
|
(( elapsedseconds = endtime - starttime - pausedtime ))
|
||||||
(( days =
|
(( days =
|
||||||
elapsedseconds
|
elapsedseconds
|
||||||
/
|
/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user