Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to run a script on a daily basis, and figured that I'd use the same setup that the other cron jobs are configured on this server - by placing the script in the /etc/cron.daily folder.

However, the script was not run overnight - although others in the daily folder were (logs were rotated, etc). The script is owned by root (as are the original ones in there), and the permissions are set to 755 (as are the original ones in there) - and the script runs when called manually.

I have found this related question Cron.hourly won't run but don't find the answers anywhere near satisfactory - sudo crontab -l tells me there is no crontab for root (although, I know I can created one), and it would make more sense to use the same method as the preinstalled jobs anyway rather than split cron configuration.

Anyone able to point at something I might have missed?

For the record - the script filename is drupal

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Managed to work out how to do a bit of debugging by using run-parts -v /etc/cron.daily - and after a disabled the apt script (with its random upto 30 minute sleep) I found the error message for the new script:

run-parts: failed to exec /etc/cron.daily/drupal: Exec format error
run-parts: /etc/cron.daily/drupal exited with return code 1

This didn't turn up in the syslog though - which would have been helpful.

That's when I realised that I hadn't but a #!/bin/sh directive at the top of the script - fixed that, ran the run-parts command again, and all sorted.

share|improve this answer

Your Answer

 
discard

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.