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

I have a cron job that I put in cron.daily folder on my UBuntu server. I assumed that this would run daily by default, but found that it was actually not running when I checked /var/log/syslog. Did I make a wrong assumption? Do I need to configure the script with crontab -e.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

By the run-parts used by ubuntu and debian cron:

  • File shouldn't have an extension.
  • File should be chmod 755.

And just to be sure:

  • /etc/crontab should have a line for launch the cron.daily scripts
  • cron should be running in the process table.
share|improve this answer
    
File does not have extension and permissions are set to 755. cron is running verified, ps -eaf | grep cron and my crontab file is. italic bold 'SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )...' italic bold –  gitarchie Apr 17 '11 at 20:42
    
Have you tried restarting crond? In theory it should work without it but I noticed that on rhel/centos it is not always picking up changes without restart. –  dtoubelis Apr 18 '11 at 3:35

Your cronjob under /etc/cron.daily/script has to be executable. Also it has to be shell script. If you want to run Perl for instance, you have to call it from within the cronjob shell script. Make sure anacron is not on the way and the others cron.daily jobs run as specified.

share|improve this answer
    
Anacron is in there, should I take that out? 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) –  gitarchie Apr 17 '11 at 20:47
    
@archie: Does the others daily cronjobs run at 6:25am? If not - then anacron messes things up. Do you have issues with them as well? –  grs Apr 18 '11 at 14:01
    
Cron did run at 6:25 am , my job failed with the info below. CRON[18056]: (CRON) error (grandchild #18057 failed with exit status 1) –  gitarchie Apr 25 '11 at 18:48
    
The error was No MTA installed, discarding output –  gitarchie Apr 25 '11 at 23:26

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.