I have a hourly cronjob script that curl
s a php script. The php script isn't being executed. In crontab -e
I have:
1 * * * * /var/www/path/to/script.sh
Doing grep cron /var/log/syslog
outputs:
Mar 23 21:45:01 Emile CRON[5339]: (root) CMD (/var/www/path/to/anotherscript.sh)
Mar 23 22:01:01 Emile CRON[5386]: (root) CMD (/var/www/path/to/anotherscript.sh)
Mar 23 22:01:01 Emile CRON[5387]: (root) CMD (/var/www/path/to/script.sh)
Mar 23 22:14:01 Emile CRON[5425]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Mar 23 22:15:01 Emile CRON[5429]: (root) CMD (/var/www/path/to/anotherscript.sh)
I've verified that the url that is being curl
in script.sh
is correct and that the path in crontab -e
is correct. I also verified that the php script works when manually executed. What else is there? Any ideas? Another way to diagnose? What's that cd / && run-parts
in my syslog?
Thanks in advance for the help!
What usually can happen is a
$PATH
problem. It'scurl
being used with it's full path onscript.sh
or justcurl
?You can also change the first line of the script (if you are using bash) from
#!/bin/bash
to#/bin/bash -x
(that will generate debug output from bash).Anyway, as @derfK said on his comment, check the user email for errors (the script debug will also be sent to the user email). You can change the email which cron uses to send messages putting
MAILTO=<email>
before the rule lines.