in reply to Self terminating a script after a specified time

Look at the Time::Limit module. It terminates the script after a given time. In your case, the usage would be:

use Time::Limit '86400.0'; # terminate after 86400 seconds (24h)

Could be just the thing you need.

- Luke

Replies are listed 'Best First'.
Re^2: Self terminating a script after a specified time
by shardservant (Initiate) on Jan 08, 2015 at 13:45 UTC
    Looking at this.. My concern is what the exit code would be on self termination. If non zero, the automated scheduling system will flag this as a job failure which is not the intention.

      Time::Limit sends the process a SIGTERM, which you can catch.The following exits with a zero exit code after 5 seconds:

      use Time::Limit -quiet, '5'; $SIG{TERM} = sub { exit 0 }; while(1) {}