cookutils diff web/cooker.cgi @ rev 824

handle multiple cook in cooktime
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 06 09:08:56 2016 +0200 (2016-08-06)
parents e9aa5ca73c9a
children 47e7b3037588
line diff
     1.1 --- a/web/cooker.cgi	Fri Jul 29 12:06:02 2016 +0200
     1.2 +++ b/web/cooker.cgi	Sat Aug 06 09:08:56 2016 +0200
     1.3 @@ -218,8 +218,8 @@
     1.4  	local state="Not running"
     1.5  	if [ -s "$command" ]; then
     1.6  		state="$(cat $command)"
     1.7 -		if grep -q "^$state" $cooktime ; then
     1.8 -			set -- $(cat $cooktime)
     1.9 +		set -- $(grep "^$state" $cooktime)
    1.10 +		if [ -n "$1" ]; then
    1.11  			state="$state $((($(date +%s)-$3)*100/$2))%"
    1.12  			[ $2 -gt 300 ] && state="$state (should end $(date -u -d @$(($2+$3))))"
    1.13  		fi