File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,7 +50,13 @@ main(){
5050cleanup (){
5151 rm_file " $LOCK_FILE "
5252}
53-
53+ update_eta (){
54+ local expected_start=$( cat " $NEXT_TIME " 2> /dev/null || echo $start_time )
55+ local drift=$(( $start_time - $expected_start ))
56+ [ $drift -lt 0 ] && drift=0
57+ local execution_time=$(( $end_time - $start_time ))
58+ echo $(( $(date +% s) + 1800 + $drift + $execution_time )) > " $NEXT_TIME " # update next time
59+ }
5460start_time=$( date +%s)
5561if [ -e " $LOCK_FILE " ]; then
5662 export LOCKED=1
@@ -73,7 +79,7 @@ if [ $LOCKED -eq 1 ]; then
7379 echo -e " Another instance is running, exiting..."
7480else
7581 if [ $CALL_FROM_DAEMON -eq 1 ]; then
76- echo $(( $(date +% s) + 1800 + $(( $end_time - $start_time )) )) > " $NEXT_TIME " # update next time
82+ update_eta
7783 else
7884 echo -e " \r[DONE] Fixed $COUNT apps in $(( $end_time - $start_time )) s. "
7985 fi
You can’t perform that action at this time.
0 commit comments