You want to schedule your script via the cron daemon. It can launch your script at predefined times conveniently. The cron manpage has information on how to do this.
If cron is not available on your system, there is Schedule::Cron, with which you can write your own small implementation of cron to launch your program at specific times. For the expiry timer, set up an alarm handler for $SIG{ALRM}, and prime it with alarm(300) or however many seconds you want to give your program:
eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; $nread = sysread SOCKET, $buffer, $size; alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out } else { # didn't }
In reply to Re: Timers and timer expire handlers
by Corion
in thread Timers and timer expire handlers
by narashima
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |