in reply to Re: Re: Mail & Win32
in thread Mail & Win32

Is there a cron is Cygwin or PPT? That may be a good idea for this. I'm currently unsure about those offerings.

Your best option for now may be to have your script run at startup from a run key in the registry or from the startup program group. Then, in order to do what you want every so often, put the code that performs the action in a loop and include a sleep $seconds; statement at the beginning or end of the loop.

If more accurately spacing the times (depending on various running times of your program) is a priority, you can start the loop like this:
my $interval = 600; #for ten minutes, adjust as needed my $time_to_work = time() + $interval;
And end it like this:
sleep ($time_to_work - time());
I should point out that this is not pretty even in my mind, but I've used similar code before when running time was variant on input or on network load. You can move the first part (excepting the declarations, of course) to the bottom of the loop and the last part to the top of the loop in order to make it wait before instead of after your main work.

This means your code is always running, but it's usually taking up (at least very close to) no processor time.

Christopher E. Stith

Replies are listed 'Best First'.
Re: Re^3: Mail & Win32
by Mitch (Sexton) on Jun 27, 2003 at 19:02 UTC
    Actually as a temporary solution that's how I have it running. But, I need to find another way, since it's running on a server and I can't stay logged on forever.

    So, the problem remains of finding another module or way of scheduling the job.