coolfire has asked for the wisdom of the Perl Monks concerning the following question:
My question is how can I do this if I have three or more jobs which runs at different intervals? Can it be possible to put above in a sub and do a foreach of different intervals/scripts to be executed? I'm thinking of a timer kind of thing which forks(parallel forks if more), execs respective script and kills child after.my $interval = 300; my $cpid = fork(); my $upto = localtime() + $interval; while (1) { if ($upto == localtime()) { $upto = localtime() + $interval; system("/home/rambo/perl-assignments/send_test_mail.pl"); } sleep 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cron functionality mimic in perl scripting
by Corion (Patriarch) on Sep 20, 2011 at 11:46 UTC | |
|
Re: cron functionality mimic in perl scripting
by moritz (Cardinal) on Sep 20, 2011 at 11:46 UTC | |
|
Re: cron functionality mimic in perl scripting
by jwkrahn (Abbot) on Sep 20, 2011 at 12:34 UTC | |
|
Re: cron functionality mimic in perl scripting
by jethro (Monsignor) on Sep 20, 2011 at 12:01 UTC | |
|
Re: cron functionality mimic in perl scripting
by zentara (Cardinal) on Sep 20, 2011 at 15:47 UTC |