Tente isto:
#!/bin/bash
work() {
# put your job here e.g.
ffmpeg -re -i "input" output.mp4
}
echo "Launching background job..."
work &
workPID=$!
RUNNING=true
while true; do
# If no child process, then exit
[ $(pgrep -c -P$$) -eq 0 ] && echo "All done" && exit
HOUR="$(date +'%H')"
if [ $HOUR -ge 17 -a $HOUR -lt 21 ] ; then
if [ "$RUNNING" == false ]; then
echo "Start work..."
kill -CONT $workPID
RUNNING=true
fi
else
if [ "$RUNNING" == true ]; then
echo "Stop work..."
kill -TSTP $workPID
RUNNING=false
fi
fi
sleep 2
done
O script inicia o trabalho como um processo filho com work &
, monitora esse processo e congela / descongela conforme necessário.