1

On a Debian server, I have a crontab entry that should call a script every day at 04:21 AM.

That's what it did, until today .. but now the script is called every 15 minutes without any reason !

I have not changed the crontab in months !

Here's the crontab line :

21 4 * * * /usr/bin/wget -O /dev/null http://www.domain.tld/tasks/hebdomadaire.php &> /dev/null

And here's the Apache log ( cat access.log | grep "hebdomadaire" ) :

SERVER_IP - - [28/Mar/2016:04:21:01 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [29/Mar/2016:04:21:01 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [30/Mar/2016:04:21:01 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:04:21:01 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:04:36:02 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:04:51:04 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:05:06:07 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:05:21:11 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:05:36:16 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:05:51:22 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:06:06:30 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:06:21:38 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:06:36:47 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:06:51:57 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"
SERVER_IP - - [31/Mar/2016:07:07:07 +0000] "GET /tasks/hebdomadaire.php HTTP/1.1" 200 454 "-" "Wget/1.13.4 (linux-gnu)"

How can that be?

4
  • Do you have any other crontab entries that might be running this wget command? As root, try grep '/tasks/hebdomadaire.php' /etc/crontab /etc/cron*/* /var/spool/cron/crontabs/*
    – cas
    Mar 31 '16 at 8:02
  • 1
    Have you looked in syslog to see if it actually is the cron job running that often? Mar 31 '16 at 8:10
  • Your command gives : /var/spool/cron/crontabs/root:21 4 * * * /usr/bin/wget -O /dev/null domain.tld/tasks/hebdomadaire.php &> /dev/null. Running 'ps' showed a non-stop wget on hebdomadaire.php .. So I killed it, and restarted cron, seems to be fixed. hebdomadaire is a quite long script, is it possible that cron restarts the script if it takes too long ? I've added cron log, maybe it will give me clues tomorrow.
    – Vincent
    Mar 31 '16 at 8:14
  • cron log shows that the script is called only once. But still, the wget is called multiple times, I can't understand why. The last line of the PHP script sends an e-mail, and since I got an e-mail every 15min, I suppose the PHP script is called multiple times by wget... why ??
    – Vincent
    Apr 12 '16 at 7:53
5

The default behaviour of wget (documented in the manual) is to restart after a default timeout of 900s (aka 15 min).

Adding --timeout=0 solves the problem here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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