kill -CONT ${client_pid}
}
+# test whether time in period (t1, t2) is infinte ("-" sign)
+# if that is the case, sleep indefinitely, waiting for shut down
+test_infinte()
+{
+ time="$1"
+
+ if test "$time" = "-"; then
+ sleep 1000d
+ fi
+}
+
parse_periods
DEBUG echo "start_time is ${start_time}"
old_time=${start_time}
for ((i = 0; i < ${#suspend_resume[@]}; i += 2)); do
+ test_infinite ${suspend_resume[$i]}
+
to_sleep=$((${suspend_resume[$i]} - ${old_time}))
sleep ${to_sleep}
client_pid=$(pgrep -P ${background_pid})
suspend_client ${client_pid}
old_time=${suspend_resume[$i]}
+ test_infinite ${suspend_resume[$(($i+1))]}
+
to_sleep=$((${suspend_resume[$(($i+1))]} - ${old_time}))
sleep ${to_sleep}
resume_client ${client_pid}
old_time=${suspend_resume[$(($i+1))]}
done
+test_infinite ${stop_time}
+
to_sleep=$((${stop_time} - ${old_time}))
sleep ${to_sleep}
stop_client ${client_type}