Terminating process/script with kill -9 or kill -15

Terminating process/script with kill -9 or kill -15

Post by BN » Thu, 05 Jan 2006 00:42:17



Greetings,

Happy New Year.

I would like to request your suggestions on the right way of
terminating the processes/scripts that run on our UNIX servers (HP-UX,
SUN, AIX)

We have online backups (oracle) and many maintenance and monitoring
scripts scheduled to run at different times of day.

Some times we have to terminate the scripts especially Oracle On-line
backups and STATS collections when they extend into day time, as they
slow down the clients.

Mostly We use kill -9 to terminate the processes/script, the greatest
disadvantage with this is that the Logging commands/scripts at the end
of the main script wont get executed.

I would like to log all the info, like errors, start and end time,
backup successful info, sizing/growth  info in to  Database tables for
analysis

I have two options:

1. Write new script(s), schedule them to run (multiples in a day) to
log the info into Database

      WE have lot of admin/monitoring scripts scheduled.

 2. Add the logging commands/script at the end of the main script.

    Less script, but kill -9 skips this.

I  appreciate your suggestions.

Regards & Thanks
BN

 
 
 

Terminating process/script with kill -9 or kill -15

Post by Lew Pitche » Thu, 05 Jan 2006 00:51:40


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Greetings,

> Happy New Year.

> I would like to request your suggestions on the right way of
> terminating the processes/scripts that run on our UNIX servers (HP-UX,
> SUN, AIX)

> We have online backups (oracle) and many maintenance and monitoring
> scripts scheduled to run at different times of day.

> Some times we have to terminate the scripts especially Oracle On-line
> backups and STATS collections when they extend into day time, as they
> slow down the clients.

> Mostly We use kill -9 to terminate the processes/script, the greatest
> disadvantage with this is that the Logging commands/scripts at the end
> of the main script wont get executed.

> I would like to log all the info, like errors, start and end time,
> backup successful info, sizing/growth  info in to  Database tables for
> analysis

> I have two options:

> 1. Write new script(s), schedule them to run (multiples in a day) to
> log the info into Database

>       WE have lot of admin/monitoring scripts scheduled.

>  2. Add the logging commands/script at the end of the main script.

>     Less script, but kill -9 skips this.

> I  appreciate your suggestions.

One suggestion: kill -9 is the A-bomb of kill commands. It
unconditionally terminates it's target, giving the target no chance to
perform it's own shutdown processing. you are sending a SIGKILL to the
process, and SIGKILL cannot be caught or ignored.

SIGTERM (kill -15) isn't as bad. It /can/ be caught and handled by the
script. Why not code a simple signal handler trap into your scripts, to
catch SIGTERM (or any of the other catchable signals), perform the
logging, and then terminate the script?

- --

Lew Pitcher, IT Specialist, Enterprise Data Systems
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFDup2LagVFX4UWr64RAh2mAKDiCxWNK9dbqZX8PeSaYcEO5vmB9ACgygh8
RKukxqIghI0lR0C/d+AsPfg=
=x0mF
-----END PGP SIGNATURE-----

 
 
 

1. A method to kill process that cannot be killed even with `kill -9'.

Try this method:
kill -9 non-killed-pid
/usr/proc/bin/prun non-killed-pid
/usr/proc/bin/pmap non-killed-pid
This method works perfectly with Solaris 6. Sometimes you can do it
without the "kill -9 non-killed-pid"

P.S. I don't know about other versions and about some hardware programs,
like tar.

--
------------------------------------------------------
Eugene S. Ilchenko, System Network Administrator
http://secinf.net/

2. Fix undefined ksym in minix.o, ext2.o, sysv.o

3. killing dead process, kill -9 doesn′t work

4. Panic on shutdown

5. how to kill a process when kill -9 won't

6. Kernel update 4 the complete idiot

7. Kill -9 won't kill a process

8. How add & compire header and expire module

9. kill -9 doesn't kill a process!

10. kill -9 doesn't kill a process

11. how to kill process when kill -9 is not working ?

12. kill -9 doesn't kill a process ?

13. Can a process kill its child if it's killed -9