I have a problem with cron jobs, I need to send email notification to users, I use this command
curl "http://example.com/index.php?option=com_community&task=cron">/dev/null 2>&1
When I run this command in shell it works, and it sends emails, but when I'm trying to set cron job it doesn't send emails:
Here is my /etc/cron.d :
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
05,45 * * * * root run-parts /etc/cron.hourly
It is suposed to run /etc/cron.hourly cron job, here is /etc/cron.hourly/0anacron :
#!/bin/bash
# Skip excecution unless the date has changed from the previous run
if test -r /var/spool/anacron/cron.daily; then
day=`cat /var/spool/anacron/cron.daily`
fi
if [ `date +%Y%m%d` = "$day" ]; then
exit 0;
fi
# Skip excecution unless AC powered
if test -x /usr/bin/on_ac_power; then
/usr/bin/on_ac_power &> /dev/null
if test $? -eq 1; then
exit 0
fi
fi
/usr/sbin/anacron -s
curl "http://example.com/index.php?option=com_community&task=cron">/dev/null 2>&1
Here is cron log, it shows that cron job is running
Aug 2 16:45:01 u17669867 CROND[3164]: (root) CMD (run-parts /etc/cron.hourly)
Aug 2 16:45:01 u17669867 run-parts(/etc/cron.hourly)[3164]: starting 0anacron
Aug 2 16:45:01 u17669867 run-parts(/etc/cron.hourly)[3173]: finished 0anacron
Maybe, there is something wrong in /etc/cron.hourly/0anacron ?