LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cron hourly, daily, cron.d jobs don't execute (https://www.linuxquestions.org/questions/linux-general-1/cron-hourly-daily-cron-d-jobs-dont-execute-585351/)

eggsmartha 09-17-2007 02:23 PM

cron hourly, daily, cron.d jobs don't execute
 
I'm running OpenSuse 10.2 and am having trouble getting jobs in cron.hourly, daily, or cron.d to run. The cron daemon is running, and when I enter a job to execute using crontab -e or just edit /etc/crontab, the jobs do run, but when I put a script into /etc/cron.d it doesn't run (for example, I have a script called testrun with permissions set to 0644 sitting in /etc/cron.d. In this file is the line */1 * * * * /bin/echo "test job executed" >> /var/log/messages. When I do a tail on /var/log/messages I see that the cron daemon reloads this file, but then I never see the line echo'd which would indicate that it actually ran. When I put the same line into /etc/crontab it runs fine and I see the message "test job executed" in /var/log/messages. Any ideas?

gilead 09-17-2007 02:33 PM

cron on my system (Slackware) uses scripts with the execute bits set in /etc/cron.daily - they're all 0755 rather than 0644. I don't know what flavour of cron that OpenSuse uses, but can you try changing the permissions to allow the scripts to execute and see if that makes a difference?

eggsmartha 09-17-2007 02:52 PM

I get a message saying "BAD FILE MODE" when I try that. I did just try modifying the entry to read */1 * * * * root /bin/echo... and the thing worked. How does adding "root" in there help things out? I don't see this documented anywhere.

gilead 09-17-2007 06:37 PM

It looks like the version of cron shipped with OpenSuse requires you to specify the user that the cron job is run as in the crontab. There's some general info at Packaging/SUSE Package Conventions/Cron Jobs which may help.

The bad file mode error is odd. Did you run something like this (as root)?:
Code:

chmod -c 0700 /etc/cron.daily/scriptname


All times are GMT -5. The time now is 09:03 PM.