Operating System - HP-UX
1833813 Members
3060 Online
110063 Solutions
New Discussion

Non-existent crons running

 
Dermot Beirne
Frequent Advisor

Non-existent crons running

Hi,
We have two old K250 running 10.20. One is a backup to the other. Periodically we swap from one to the other, so that the backup becomes the live box for a few months, and vice versa.
As part of this swapover, we copy the crons from the live box to the backup box, and vice versa.
However, on this occasion, after the two boxes were restarted after swapping identities we forgot to stop the cron daemon before swapping the crons.
So basically, the server that is now the backup box, appears to be running it's old cron jobs, even though they are no longer in the /usr/spool/cron/crontabs directory. The /var/adm/cron/log files shows entries for the non-existent jobs running, and i am receiving emails from the relevant cron jobs.
How can I find and stop these jobs. They don't show up in ps -eaf, and i have restarted the cron daemon a few times. I can restart the box if necessary, but thought I'd ask here first.

Thanks,
Dj
Happy is harder than money. Anyone who thinks money will make them happy, doesn't have money.
7 REPLIES 7
Muthukumar_5
Honored Contributor

Re: Non-existent crons running

Is there any other schedular like at running? Check /var/spool/cron/atjobs directory also.

hth.
Easy to suggest when don't know about the problem!
Steven E. Protter
Exalted Contributor

Re: Non-existent crons running

Shalom Dermot,

Set up a little control file:

/etc/rc.config.d/machinestatus
# for example

It should say:

STATUS=LIVE

or

STATUS=STANDBY

Then you can have this code in a startup script:

. /etc/rc.config.d/machinestatus

if [ "$STATUS" = "STANDBY" ]
then
/sbin/initd/cron stop
fi

Now the real problem here is not having a switchover checklist for when you machine swap.

My code is totally unnecessary and actually redundant.

You can make a checklist for the admin doing the swap.

vi /etc/rc.config.d/cron

# Change the first variable in the file to 0 on the standby machine and 1 on the new live machine.

Boot them.

You are done, cron can't possibly be running unless some script fires it up.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dermot Beirne
Frequent Advisor

Re: Non-existent crons running

Hi,
There are no "at" jobs running. Thanks for the info Steven, but is there a way of seeing where the cron jobs that are currently running are coming from, and how to stop them.

Dj.
Happy is harder than money. Anyone who thinks money will make them happy, doesn't have money.
Andy Torres
Trusted Contributor

Re: Non-existent crons running

/var/adm/cron/log or /var/adm/cron/OLDlog may help track down your culprit.
Geoff Wild
Honored Contributor

Re: Non-existent crons running

Strange - restarting cron (stop/start) should have fixed it...

How about su'ing to each id that has cron jobs, do a crontab -e, save it, then watch...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Tom Ward_1
Honored Contributor

Re: Non-existent crons running

Hello Dermot,

You shouldn't need to reboot the host.

If you have cleared the crontabs file out of /var/spool/cron/crontabs then you should be able to stop them by cycling the cron daemon.
cd /sbin/init.d
./cron stop
./cron start

That should take care of it for you.
Dermot Beirne
Frequent Advisor

Re: Non-existent crons running

Strange, about an hour later (after last crond restart), it all stopped happening. Didn't restart the machine. Will monitor over the weekend.
Thanks for advice.
Dj
Happy is harder than money. Anyone who thinks money will make them happy, doesn't have money.