1835988 Members
2274 Online
110088 Solutions
New Discussion

CRON Daemon corrupt?

 
Kevin Lai_1
Occasional Advisor

CRON Daemon corrupt?

Recently I discovered that my cronjobs had not been running since I rename the machine and changed its IP.

I had restarted by cron daemon with:
/sbin/init.d/cron stop
/sbin/init.d/cron start

ps grep shown its running.
and the /var/adm/cron/log shown the command "executed".
But in reality the assigned jobs was not run.

What went wrong?

[raphael]:/sbin/init.d># ls -l /sbin/*/*cron*
-r-xr-xr-x 1 bin bin 1275 Nov 14 2000 /sbin/init.d/cron
lrwxr-xr-x 1 root root 17 Feb 3 2004 /sbin/rc1.d/K270cron -> /sbin/init.d/cron
lrwxr-xr-x 1 root root 17 Feb 3 2004 /sbin/rc2.d/S730cron -> /sbin/init.d/cron

The cron.allow are proper, the file permission are proper..

But I just can't figured out what caused the malfunction.

Anyone?
5 REPLIES 5
Carlos Roberto Schimidt
Regular Advisor

Re: CRON Daemon corrupt?

If show the command "executed", why do you try redirect output of your script?
#crontab -l
0,15,30,45 * * * * /yourscripts.sh >>/tmp/yourscript.log 2>>/tmp/yourscript.err

After run your script by cron, look for anything in these files.

Yogeeraj_1
Honored Contributor

Re: CRON Daemon corrupt?

hi kevin,

can you try to schedule a simple script that simply writes "hello world" to a file (e.g. /tmp/helloworld.txt)

script: (helloworld.sh)
#!/bin/sh
echo " hello world" > /tmp/helloworld.txt
#end of script

Add to your crontab: (assuming it is almost 09:00 am)

00 09 * * * /home/yd/helloworld.sh 1>/home/yd/output-helloworld.crn 2>/home/yd/error-helloworld.crn
#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************
#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************


see if it works!

revert

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Kevin Lai_1
Occasional Advisor

Re: CRON Daemon corrupt?

Did a test, still no output.

My crontab:

0,10,20,30,40,50 * * * * /usr/local/bin/testcron.sh >>/tmp/testcron.log 2>>/tmp/testcron.err

Excerpt of /var/adm/cron/log:

> CMD: /usr/local/bin/testcron.sh >>/tmp/testcron.log 2>>/tmp/testcron.err
> root 10926 c Wed Feb 15 14:10:00 SST 2006

There is no testcron.log or testcron.err files created in /tmp

Any idea what went wrong?
Kevin Lai_1
Occasional Advisor

Re: CRON Daemon corrupt?

Found out the source of the problem.

Mails to the cronjobs owners:

"Cron: Your job did not contain a valid audit ID"

It believe that the switching from Trusted mode to non-trusted system and at the same time rename my machine name and change the IP address, it might have impaired my cron system.

I shutdown the cron, and remove all the unnecessary audit directories in the /usr/spool/cron.

To be safe, I backup the old crontabs, and mkdir a new crontabs with proper ownership and permission.

Restart the cron daemon.

Now my cron daemon is functioning.

Anyway, thanks for all the assistance I had received.

Regards.

Kevin Lai_1
Occasional Advisor

Re: CRON Daemon corrupt?

Problem caused by residual invalid Audit ID.