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.

The cron log at /var/log/cron gives me the following when I reboot the system or manually start cron (with /etc/init.d/cron start):

Jul 2 10:17:31 monserver /usr/sbin/cron[17386]: (CRON) INFO (pidfile fd = 3)

Jul 2 10:17:31 monserver /usr/sbin/cron[17387]: (CRON) STARTUP (fork ok)

Jul 2 10:17:31 monserver /usr/sbin/cron[17387]: (CRON) DEATH (Can't create reboot check file)

Verified that cron is truly not running with ps aux | grep cron

This server has recently had permissions issues with other applications (nagios for one). I wouldn't be surprised if that's the case here, but I haven't been able to track down the location of this "reboot check file". It's an older Debian system (ver 5.0.2).

Please let me know if more info is required (I'm still learning) and thanks for your help!

share|improve this question

3 Answers 3

This is by the way the Debian specific code being triggered. As karmawhore already have stated, it does seem like you have permission problems with /var/run, preventing /var/run/crond.reboot from being created.

#ifdef DEBIAN
#define REBOOT_FILE "/var/run/crond.reboot"
       /* Run on actual reboot, rather than cron restart */
       if (access(REBOOT_FILE, F_OK) == 0) {
               /* File exists, return */
               log_it("CRON", getpid(),"INFO",
                      "Skipping @reboot jobs -- not system startup");
               return;
       }
       /* Create the file */
       if ((rbfd = creat(REBOOT_FILE, S_IRUSR&S_IWUSR)) < 0) {
               /* Bad news, bail out */
               log_it("CRON",getpid(),"DEATH","Can't create reboot check file");
               exit(0);
       } else {
               close(rbfd);
               log_it("CRON", getpid(),"INFO", "Running @reboot jobs");
       }


        Debug(DMISC, ("[%d], Debian running reboot jobs\n",getpid()));

#endif
share|improve this answer
    
The /var/run directory does have the 755 permissions set. The owner:group is set to root, is this correct? What is this checking for " if ((rbfd = creat(REBOOT_FILE, S_IRUSR&S_IWUSR)) < 0) "? –  locustpocust Jul 2 '10 at 17:07
1  
The creat() system call will return -1 if it fails for any reason (see man 2 creat). It's supposed to set errno so you know the exact reason it failed, but Debian apparently doesn't check for it or log it. You might try running cron by hand under strace to get the exact error code. The creat(2) manpage shows the errors it can return, and you can map those to the error numbers in /usr/include/asm-generic/errno-base.h or /usr/include/asm-generic/errno.h. –  James Sneeringer Jul 2 '10 at 18:03

It sounds like /var/run has incorrect permissions, 755 is what the base debian installer sets /var/run

Alternatively, perhaps /var/run/crond.reboot has become immutable?

lsattr /var/run/crond.reboot

to see if the i or a bits are set.

chattr -ia /var/run/crond.reboot

if either or both are set.

share|improve this answer
    
Thanks for the response. The /var/run/crond.reboot file is not being created at all. The crond.pid file is being created. /var/run has the 755 permissions set: drwxr-xr-x 10 root root 4096 2010-07-02 11:49 run –  locustpocust Jul 2 '10 at 17:03

Cron appears to be running after manually creating an empty /var/run/crond.reboot file and restarting cron (with /etc/init.d/cron start). Bizarre. Probably just a temporary fix. It survives being restarted, but it remains to be seen whether it will survive a system reboot (fun for another day). Thanks karmawhore and andol for your much needed advice.

share|improve this answer

Your Answer

 
discard

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