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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -