I am unable to configure a cron job to run by placing it in /etc/cron.hourly folder.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
The file under cron.hourly is :
lrwxrwxrwx 1 root root 40 2010-07-26 14:52 check -> /usr/local/xxxx/check-interface.bash
Permissions on the file :
-rwxr-xr-x 1 root root 1.6K 2010-09-13 11:22 /usr/local/xxxx/check-interface.bash
There seems to be no errors reported in the var/log/cron logfile. No mention of the script is done. 🙁
Best Answer
In order to isolate the problem, move /usr/local/xxxx/check-interface.bash to /etc/cron.hourly/check , and then see if it runs.
If the script does run, then the problem is caused by an ownership/permissions or related issue which is preventing cron from executing scripts at /usr/local/xxxx/*.
If the script does not run, then the problem is most likely with your script itself.
As another sanity check, replace the contents of
/usr/local/xxxx/check-interface.bash
with something dead simple, like:And then see if /tmp/check-interfaces.log is actually being populated by your cronjob. If it does work, then the problem must be with your original script.