- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- About the kill command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:14 PM
тАО05-25-2006 08:14 PM
About the kill command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:23 PM
тАО05-25-2006 08:23 PM
Re: About the kill command
signum signame Name Description
___________________________________________________________________________
0 SIGNULL Null Check access to pid
1 SIGHUP Hangup Terminate; can be trapped
2 SIGINT Interrupt Terminate; can be trapped
3 SIGQUIT Quit Terminate with core dump; can be trapped
9 SIGKILL Kill Forced termination; cannot be trapped
15 SIGTERM Terminate Terminate; can be trapped
24 SIGSTOP Stop Pause the process; cannot be trapped
25 SIGTSTP Terminal stop Pause the process; can be trapped
26 SIGCONT Continue Run a stopped process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:23 PM
тАО05-25-2006 08:23 PM
Re: About the kill command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:24 PM
тАО05-25-2006 08:24 PM
Re: About the kill command
see:
man kill
0 SIGNULL Null Check access to pid
1 SIGHUP Hangup Terminate; can be trapped
2 SIGINT Interrupt Terminate; can be trapped
3 SIGQUIT Quit Terminate with core dump; can be trapped
9 SIGKILL Kill Forced termination; cannot be trapped
15 SIGTERM Terminate Terminate; can be trapped
24 SIGSTOP Stop Pause the process; cannot be trapped
25 SIGTSTP Terminal stop Pause the process; can be trapped
26 SIGCONT Continue Run a stopped process
If you kill a parent process this may trigger the kill on the attached processes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:27 PM
тАО05-25-2006 08:27 PM
Re: About the kill command
First you should try simply
# kill
which is equivalent to "-15" SIGTERM. This gives your process the possibility to terminate gracefully.
If this doesn't help, use
# kill -9
kill command is used to send signals to processes, not only to "kill" them.
see "man kill"
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:34 PM
тАО05-25-2006 08:34 PM
Re: About the kill command
Floating Point Exception (FPE) is not a best way to kill a process. It will dump a core.
You can try with -15 or -9 with kill command,
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 08:44 PM
тАО05-25-2006 08:44 PM
Re: About the kill command
First, make usre that you isolate the process that you *really* want. Use the XPG4 (UNIX95) options of 'ps' achieves this.
Never kill with 'kill -9' except as a last resort. A 'kill -9' cannot be ignored or trapped and it doesn't give a process any chance to clean up shared memory segments or remove temporary files.
Instead, use a multi-level kill, starting with a hangup; then a simple 'kill -15'; and as a last resort a 'kill -9'.
The following code accomplishs the above. If any level of killing succeeds, the script exits. If there is any chance that you have multiple processes by the same name, this code accomodates that too.
# cat .killer
#!/usr/bin/sh
myproc=`basename ${1}`
[ -z "${1}" ] && { echo "no process specified!"; exit 1; }
mypid=`UNIX95= ps -C ${myproc} -o pid=`
if [ ! -z "${mypid}" ]; then
kill -1 ${mypid} 2>/dev/null
sleep 3
kill -15 ${mypid} 2>/dev/null
sleep 3
kill -9 ${mypid} 2>/dev/null
fi
exit 0
...You can see how this works by doing:
# sleep 120 &
# ./killer sleep
(or)
# nohup /usr/bin/sleep 120 &
# ./killer sleep
If you wish to integrate this into a subroutine in an existing script, change the 'exit' to a 'return' within the subroutine
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 09:01 PM
тАО05-25-2006 09:01 PM
Re: About the kill command
process identifier. The default signal is SIGTERM, which normally
terminates processes that do not trap or ignore the signal.
pid is a process identifier, an unsigned or negative integer that can
be one of the following:
> 0 The number of a process.
= 0 All processes, except special system processes, whose
process group ID is equal to the process group ID of the
sender.
=-1 All processes, except special system processes, if the user
has appropriate privileges. Otherwise, all processes,
except special system processes, whose real or effective
user ID is the same as the user ID of the sending process.
<-1 All processes, except special system processes, whose
process group ID is equal to the absolute value of pid and
whose real or effective user ID is the same as the user of
the sending process.
Process numbers can be found with the ps command (see ps(1)) and with
the built-in jobs command available in some shells.
first try #kill
and then try #kill -9 >process_id>
but -9 will kill other dependency process.
regards;
mustafa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2006 11:48 PM
тАО05-25-2006 11:48 PM
Re: About the kill command
Bill Hassell, sysadmin