linux - Exit perl script automatically every 2 hours -


i have perl scipt need end every 2 hours on linux machine. going separate script , add on cron.d accomplish this, wanted easier way. has graceful exit because after doing ctrl+c, writes log file , killing won't write file.

you can set alarm @ beginning of script, , provide handler it:

alarm 60 * 60 * 2; local $sig{alrm} = sub {     warn "time over!\n";     # logging here...     exit }; 

the question how restart script again.


Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -