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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -