in reply to Timers and timer expire handlers
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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Timers and timer expire handlers
by narashima (Beadle) on Mar 27, 2006 at 22:09 UTC | |
by Corion (Patriarch) on Mar 28, 2006 at 06:11 UTC | |
by narashima (Beadle) on Mar 28, 2006 at 14:06 UTC |