Jump to content

Timeout in cron job


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

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.