26 Feb
2003
26 Feb
'03
03:41
On Tue, 25 Feb 2003 19:26:16 -0600 DB Trollwrote: > How do I kill or terminate an application without rebooting. This has been partially answered. 1. Find the pid for the app. 2. use SIGTERM first so the application can shut itself down gracefully: kill -TERM 23824 (assuming that 23824 is the correct pid). 3. If the application has not terminated, the use the SIGKIL signal: kill -9 23824 The SIGKILL signal cannot be caught by the application. There are some things that may prevent the application from completely dieing, such as pending I/O, child processes, et. al. BTW: I have a Bourne shell kill script that also kills by name: Kill -9 foo ------------ begin #!/bin/sh if [ $# -lt 2 ];then echo Usage: $0 -signal pattern;exit 1;fi kill $1 `ps gawux \ | grep "$2" \ | sed -e "/ $$ /d" -e "/ grep /d" -e 's/ */ /g' \ | cut -f2` exit 0 # # Kill - # This script runs 'ps gawux' and kills the processes that match the pattern. # Warning: It is very easy to kill more than you intended to kill. ------------end Note that the script does have a minor bug in it. Also note that the 's/ */ /g' is really 's/ */\t/g' But the \t (tab) will not expand in the pattern. Just about every Unix guy I know has some variant of this hanging around, and there are some perl variants. -- Jerry Feldman Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9