1

I have a script that creates a file in cron.d and puts some jobs in it. Cron seems to not execute these jobs at all, since the program it runs is set to log all executions. The file inside cron.d looks something like this:

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
*/1 * * * * root /usr/bin/python /home/myname/some_script.py --switch1
2 21 * * 4 root /usr/bin/python /home/myname/some_script.py --switch2 --switch3

Neither of these jobs is executed and I can't find anything in grep CRON /var/log/syslog. The scripts work fine when executed normally. Any ideas?

EDIT: Adding the line */1 * * * * root echo "something" >> /tmp/something works fine.

Note: Though AskUbuntu won't show it, the file does have a trailing newline.

1 Answer 1

1

Turns out, my script was creating the file in cron.d with the wrong permissions. This was causing cron to ignore the script.

chmod 600 /etc/cron.d/myfile fixed the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .