in reply to Re: Self terminating a script after a specified time
in thread Self terminating a script after a specified time

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.
  • Comment on Re^2: Self terminating a script after a specified time

Replies are listed 'Best First'.
Re^3: Self terminating a script after a specified time
by Anonymous Monk on Jan 08, 2015 at 17:52 UTC

    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) {}