You're Doing It Wrong.
I'm pinging a web-service to start a background job at fixed interval times - exactly every 15 minutes of the hour 00:15, 00:30 etc. So I ping a PHP script that determines if it's time to run, and runs if so
Which means what you really want to do is Run a task exactly every 15 minutes of the hour.
You should be using cron for this, but not the way you're thinking. You want to either:
- Create a crontab entry like
*/15 * * * * /command-to-run on the server where you want the job to run.
or alternatively
- Create a crontab entry like
*/15 * * * * wget http://script-to-starton some remote server with a reliable clock.
(If */15 isn't what you want 15,30,45 probably is -- that excludes the top of the hour).
Refer to any decent crontab(5) man page for more details.
cronjob that runs every fifteen minutes. If you really need to do something every five seconds, this sounds like a candidate for a loop in a bash script with a five-second sleep. – Richard Cook Aug 02 '13 at 20:46