DAB cron not working

apmuthu

Renowned Member
Feb 26, 2009
871
11
83
Chennai - India & Singapore
github.com
Just built a sample moodle install inside a debian 5 VE container.
Needed to execute a cron job every 5 minutes.
Placed a file with the following contents into /etc/cron.d/ folder:
Code:
# /etc/cron.d/moodle: crontab fragment for moodle
*/5 * * * * wget -q -O /dev/null [URL]http://localhost/admin/cron.php[/URL]
Restarted the Apache with:
/etc/init.d/apache2 restart
The /var/log/apache2/access.log doesn't show any entry every 5 minutes, but when we execute the following from the console
we get the entry in the /var/log/apache2/access.log file.
Even after restarting the container itself, the same situation persists.
Also chmoded /var/www/moodle/admin/cron.php file to be 755 chowned by www-data:www-data.
 
Last edited:
Just built a sample moodle install inside a debian 5 VE container.
Needed to execute a cron job every 5 minutes.
Placed a file with the following contents into /etc/cron.d/ folder:
Code:
# /etc/cron.d/moodle: crontab fragment for moodle
*/5 * * * * wget -q -O /dev/null [URL]http://localhost/admin/cron.php[/URL]
Restarted the Apache with:

The /var/log/apache2/access.log doesn't show any entry every 5 minutes, but when we execute the following from the console we get the entry in the /var/log/apache2/access.log file.
Even after restarting the container itself, the same situation persists.
Also chmoded /var/www/moodle/admin/cron.php file to be 755 chowned by www-data:www-data.

I remember we configure a cron in our drupal appliance, take a look there.
 
Thanks Tom, not in drupal but in acquia.

The problem was that the whole path for the wget was needed not just the wget. Needed to put the following into the Makefile:

Code:
    # install crontab
    echo "*/5 * * * * root /usr/bin/wget -O /dev/null -q http://localhost/admin/cron.php" > ${BASEDIR}/etc/cron.d/moodle
 
It works!

VM Manager -> Click the VM Detail Line
VM Manager -> Logs -> Boot/Init
There will be a line:
Code:
.
.
.
Starting periodic command scheduler: crond. 
.
.
.
VM manager -> Logs -> SysLog
we have a series of lines like:
Code:
Sep 7 09:15:01 moodle /USR/SBIN/CRON[675]: (root) CMD (/usr/bin/wget -O /dev/null -q http://localhost/admin/cron.php)
Sep 7 09:20:01 moodle /USR/SBIN/CRON[675]: (root) CMD (/usr/bin/wget -O /dev/null -q http://localhost/admin/cron.php)
Sep 7 09:25:01 moodle /USR/SBIN/CRON[675]: (root) CMD (/usr/bin/wget -O /dev/null -q http://localhost/admin/cron.php)
 
Your /etc/pam.d/crond is exactly the same as mine and cron works for me in cooker with no errors.

Hopefully someone with more knowledge will come along and give you an answer.

Ken
 
Hi LeMarque,

Take a look at your cron log to see if there is anything in there about why it failed too. Its /var/log/cron.

If you dont see anything there you might want to post on their site about logging errors for that cron job or something.

Oh and the wget error should show up in the Apache error log /usr/local/apache/logs/error_log.