On Sat, Jul 28, 2001 at 01:56:46PM +0200, Ackim Chisha wrote:
> Does any one already have a perl script for NT that I could use to run like
> a cron job in unix. Am writing a scrip that I need to have running every 5
> minuteseveryday. Or is there a way I can write my script so that it runs
> every 5 minutes. Task sheduler on NT looks like it cant help run my script
> every 5minutes everyday.
>
> Any help will be appreciated.
Three thoughts:
1. Schedule at jobs to run your script every five minutes.
$script_path = 'c:\path\to\myscript.pl';
for $hour (0..23) {
for ($min = 0; $min < 60; $min += 5) {
$cmd = sprintf ("at %02d:%02d /e:m,t,w,th,f,sa,su %s",
$hour, $min, $script_path);
system($cmd);
}
}
2. Have your script run in an infinite loop. At the bottom of the
loop, sleep until 5 minutes are up:
$five_minutes = 5 * 60;
while (1) {
$start_time = time;
do_stuff;
sleep($five_minutes - (time - $start_time));
}
3. Search the net for a Windows-native cron program, of which I'm
sure there must be a bunch.
Walt
PGP signature