Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

If I scp a cron file into /etc/cron.d it doesn't run unless I edit the file and change the command. Then crond seems to pick up the cron file.

How can I make cron reload its cron files in ubuntu 10.04? 'touch'ing the file doesn't work nor does 'restart cron' or 'reload cron'.

My cron file is set to run every minute and logs to a file. Nothing ends up in the log file until I edit the command, and there's no entry for it in /var/log/syslog

I'm stumped.

Here's my cron file saved to /etc/cron.d/runscript (note it ends with a new line)

# Runs the script every minute. This is safe because it will exit with success if it's already running
* * * * * www-data if [ -f /usr/local/bin/thing ]; then exec /usr/bin/php /usr/local/bin/thing mode:prod -a 14 -d >> /var/log/thing/mything.log 2>&1; else echo `date +'[\%D \%T]'` "Thing not deployed. Command not run" >> /var/log/thing/mything.log; fi &
share|improve this question
It's good that you included the user to run the job as. I left that out, which was the cause of my troubles. –  nilbus Oct 21 '14 at 2:18

2 Answers 2

Check that the file you are copying ends in a \n. Entries in crontabs that don't have a \n at the end generally run into problems. The easiest way to ensure this is to put a blank line after your last entry.

share|improve this answer
I was just about to edit my question to say that it does end with \n –  tom Sep 7 '12 at 9:43

I've just run into this problem and whilst it will not answer your specific case, it may well help other people googling the same problem as this question returns very high in the results.

I had saved a file in /etc/cron.d and it was being ignored. In my case it was because I had given the files an extension.

mytask.cron did not work but I renamed it to mytask and it worked fine.

Any files with extensions are ignored, so make sure your file that you save does not have any extension.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.