Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
Do you have any logfile output from cron? – Sven Apr 21 '11 at 10:33
you should check the script and debug it, if it gets stuck in a loop then there's nothing you can do without changing the php script – quamis Apr 21 '11 at 10:56
I've tried it with a one line script which just outputs "hello" and I still get the same behaviour – Pezholio Apr 21 '11 at 11:51

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

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

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

share|improve this answer
OK, cool, I've got that now. Checking the log file it seems to be constantly running still. Looking at my log file I just get: Resolving Connecting to||:80... connected. HTTP request sent, awaiting response... --2011-04-21 12:47:00-- Ad infinitum. I've tried it with a test script which just outputs "Hello" and it does the same thing, so it's definitely not my code. – Pezholio Apr 21 '11 at 11:50
Yeah, still get the same problem. It's strange because I've got other jobs that run fine? – Pezholio Apr 21 '11 at 13:33
Ok, then try curl instead of wget: curl -m 90 -o /tmp/curl.log – initall Apr 21 '11 at 14:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.