I've set up a cron job to wget a PHP script every hour. However, it seems to get stuck in a loop and constantly running. If I run the script in a browser or via the command line it works fine. I've tried using wget and command line PHP and I get the same problem.
Here's my job:
0, 9-18, * * 1-5 wget http://www2.lichfielddc.gov.uk/planning/cron.php
Best Answer
Remove the commata from your minute and hour columns. Specify timeouts and retries explicitely like with
0 9-18 * * 1-5 wget -a /tmp/cron.log --tries=1 --timeout=90 http://www.example.com
You may want to add a log during your tests, this is done with
-a
in the example.[Edit after comment:]
To get to know that it's not smth. wget specific you could replace your cron command line with a timout command that has a higher duration than the 90secs timeout I added in my example:
timeout --kill-after=110 --signal=15 110 wget -a /tmp/cron.log --tries=1 --timeout=90 http://www.example.com
wget should stop after 90 secs, if not,
timeout
terminates it after 110 secs. (signal SIGTERM=15 should be sufficient, if not use SIGKILL=9).