phppup Posted April 25, 2018 Share Posted April 25, 2018 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? Quote Link to comment https://forums.phpfreaks.com/topic/307206-timeout-in-cron-job/ Share on other sites More sharing options...
Barand Posted April 25, 2018 Share Posted April 25, 2018 Run cron job 1 Wait a few minutes Run cron job 2 Quote Link to comment https://forums.phpfreaks.com/topic/307206-timeout-in-cron-job/#findComment-1558083 Share on other sites More sharing options...
phppup Posted April 25, 2018 Author Share Posted April 25, 2018 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? Quote Link to comment https://forums.phpfreaks.com/topic/307206-timeout-in-cron-job/#findComment-1558093 Share on other sites More sharing options...
kicken Posted April 26, 2018 Share Posted April 26, 2018 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. Quote Link to comment https://forums.phpfreaks.com/topic/307206-timeout-in-cron-job/#findComment-1558127 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.