http://www.perlmonks.org?node_id=11111546


in reply to Signal to a sleeping Perl program

I had the opposite idea of davido's: if you loop with a sleep, you could extend the loop condition like this:
while (! -e '/predefined/location/time_is_up') { do {'your thing'}; sleep 900; }
or, in appropriate places
exit if -e '/predefined/location/time_is_up';
This would cause the script to end if you create that file.