I had a similar problem a few months ago. I did a Web search and recall seeing some posts complaining that /etc/cron.d didn’t work like it used to.
I solved my problem by moving my cron job into a crontab in /var/spool/cron/tabs. Simply create a file with the appropriate username (in your case, root) and put the job in there. Remove the “root” username spec from the job (it’s implied by the name of the file when you run from a spool/tab).
Swerdna has an excellent how-to on using the crontabs. You can see the minor differences by following his advice.
If that doesn’t work, then as the previous poster suggested, ensure the cron itself is running: execute “server cron status” as root in a terminal, or use Yast -> System -> Services (Runlevels).
Well, the cron deamon is running fine, but /var/log/message/doesn’t list the update job.
I’m using the /etc/crontab file for custom time/user configurations for some of the jobs. All these entries are executed normally. I’ve included the update command in this file, we’ll see the results tomorrow…
I wonder why are there so many possibilities to run cronjobs:
files in cron.daily, cron.hourly, …
files in cron.d
crontab -e
/etc/crontab
The only interesting difference is the one-file-per-user scenario with crontab -e
In the beginning there were two locations, per user using crontab -e and the system crontab /etc/crontab.
/etc/cron.d is a logical extension of /etc/crontab. It allows packages to easily put and remove custom crontabs there without having to disturb the master crontab. It’s also a good place to put app specific crontabs, you can group a bunch of actions which might be run by different accounts, for say moodle.
/etc/cron.{hourly,daily,weekly,monthly} are actually caused from that initial entry in /etc/crontab which says /usr/lib/cron/run-crons
Well, after a long time, i’ve found the solution. Maybe someone can use this information:
I’ve copied the cron files from a NAS back to the server, and i think it was just an encoding problem.
Using
cat /var/log/messages | grep cron
, i’ve found these lines:
Mar 3 00:55:01 bscw /usr/sbin/cron[21357]: (root) CMD ( ^I/usr/bin/freshclam --quiet)
Mar 3 01:00:01 bscw /usr/sbin/cron[21540]: (root) CMD ( ^I/usr/bin/clamscan -r --quiet --exclude-dir=/srv/nas /tmp /srv )
As you can see, there are two additional characters in front of the command (^I). I’ve no idea what this is, but i think it’s a problem from different tabulator encoding. (Hope i described this correctly)
I’ve just used vi for editing the crontab and replaced the tabulator spacing. Since then, everything works fine.