# HG changeset patch # User Pascal Bellard # Date 1470467336 -7200 # Node ID 5d200ccc3cee6a9e8fb15a8d78952aa5317b6a6c # Parent e9aa5ca73c9abdf572d0920410064c5da25ffc20 handle multiple cook in cooktime diff -r e9aa5ca73c9a -r 5d200ccc3cee cook --- a/cook Fri Jul 29 12:06:02 2016 +0200 +++ b/cook Sat Aug 06 09:08:56 2016 +0200 @@ -1888,7 +1888,11 @@ _ 'Cook started for: %s' "$pkg" | log echo "cook:$pkg" > $command [ "$lastcooktime" ] && - echo "cook:$pkg $lastcooktime $(date +%s)" > $cooktime + echo "cook:$pkg $lastcooktime $(date +%s)" >> $cooktime + while read cmd duration start; do + [ $(($start + $duration)) -lt $(date +%s) ] && + echo "sed -i '/^$cmd $duration/d' $cooktime" + done < $cooktime | sh # Display and log info if cook process stopped. # FIXME: gettext not working (in single quotes) here! diff -r e9aa5ca73c9a -r 5d200ccc3cee web/cooker.cgi --- a/web/cooker.cgi Fri Jul 29 12:06:02 2016 +0200 +++ b/web/cooker.cgi Sat Aug 06 09:08:56 2016 +0200 @@ -218,8 +218,8 @@ local state="Not running" if [ -s "$command" ]; then state="$(cat $command)" - if grep -q "^$state" $cooktime ; then - set -- $(cat $cooktime) + set -- $(grep "^$state" $cooktime) + if [ -n "$1" ]; then state="$state $((($(date +%s)-$3)*100/$2))%" [ $2 -gt 300 ] && state="$state (should end $(date -u -d @$(($2+$3))))" fi