I'm setting up a mailing subroutine for one of my customers that will send
mail based upon a delay of X amount of hours (selected via web form).

If I use something like:

  sub send_on_schedule {
   my $hours = $q->param('delay');
   my $sleeptime = $hours * 3600; # how many seconds?
   my @addresses = ('[EMAIL PROTECTED]','[EMAIL PROTECTED]'); # from a DB
   sleep $sleeptime;
   foreach my $address(@addresses) {
    some_mail_sending_routine($address);
   }
  }

then my script/process could technically be running for 24 hours before
sending the mail. I want to allow the delay, but I don't think it's a good
idea for that process to be running the entire time.

I gave some thought to using a cron job, but basically what would have to
happen is that in every instance, I'd have to create a crontab, run the
cron, then destroy it again. Still, this might be better.

Is there a third alternative? Suggestions please? Thanks.

-----
Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to