I want to be able to run a script after a certain duration has elapsed. I also want to be able to cancel it and reschedule it, i.e. increase the duration on-the-fly.
I was thinking of somthing like this ->
stop_prev_instance.sh; sleep 60 && /etc/init.d/myscript reload
My problem is I need the
stop_prev_instance.sh to only stop the previous run if it was
sleeping, and not if the
/etc/init.d/myscript reload command is running.
What would be the right way to solve this problem?