[CentOS] Bullet proof cron job???

Ted Miller tmiller at broadcast.net
Mon Sep 25 05:35:20 UTC 2006


Les Mikesell wrote:
> On Thu, 2006-09-21 at 22:14, Ted Miller wrote:
> 
>>I have a cron job that runs once a day.  There are times when it runs that 
>>it disrupts other things on the computer, so I want to kill it.  Under 
>>Mandriva I had no problems killing the process, and that was the end of 
>>that.  Under Centos I cannot kill it with a sig 15 or a sig 9.  Tonight the 
>>process would have trashed hours of work, so after spending two minutes as 
>>root trying to kill the process, I ended up killing the entire tree, 
>>including crond.  Linux is supposed to allow CONTROL of things like this 
>>without rebooting, etc, so why can't I kill the process without killing crond?
> 
> 
> Scheduling something that may cause trouble sounds like a problem
> in its own right, but Centos shouldn't be doing anything
> special to keep signals from reaching processes.   What
> kind of error do you get when you issue the kill command?

No error message at all, that is what is so frustrating.  The command line 
accepts the kill commands, but the process doesn't stop.  Same if I use top 
to issue the commands.  I can issue kill 15 or kill 9 for the process #, 
and it is as if nothing happened.

> If you aren't root or the process owner you shouldn't be
> permitted to send the signal.

Logged in as root.

> If you are, the process
> itself can trap it, but not signal 9.  A kill -9 should
> stop anything unless it is hung up in a device driver.

It is not hung up, it is executing as expected, (but I occasionally don't 
want that to execute).

Since nobody has any easy answers, maybe this makes a difference: The cron 
job is a shell script, and the line of the shell script that is executing 
while I attempt the shutdown is this:

/sbin/shutdown -kh +5

While that command won't hurt anything, it is what executes just after it 
that I am trying to abort (before it starts).

Ted Miller






More information about the CentOS mailing list