Jump to content

Timeout in cron job


phppup

Recommended Posts

 

I have created a Cron job that will send an email to new subscribers when they register. A second email will be sent a week later.

For demonstration purposes, waiting more than a few minutes for the second email is not practical.

Is there a way within PHP to set a timeout function, so that email number two can be initiated shortly after email number one?

Link to comment
Share on other sites

Even if I stagger the execution intervals of job 1 and 2, there would be no guarantee during a presentation that there is no delay, at which point cron2 would run before cron1.

Unless my thinking is wrong, I would like to run cron1 and incorporate something similar to a js script saying "wait 5 minutes and execute cron2."

Can this be done?

Link to comment
Share on other sites

Don't use cron jobs if you're trying to demo something. Setup a way to manually trigger that task and just trigger it when you get to that point in your demo.

 

"So now that we've registered we'll get an email welcoming us to the site. After a week has past we'll then get a reminder email for blah. Since I don't want to sit here for a week, let's speed that up."

"<Push button to trigger email>"

 

How crude or fancy you want to make that manual trigger is up to you. I generally will just pull up a command line and run the same command as the cron job would run.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.