- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: 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
Forums
Discussions
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
01-11-2006 04:04 PM
01-11-2006 04:04 PM
While killing a process as a root the command "$kill pid" is preferable or "kill -9 pid" preferable ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:07 PM
01-11-2006 04:07 PM
Re: kill command
tienna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:09 PM
01-11-2006 04:09 PM
Re: kill command
kill -9 is preferred always,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:10 PM
01-11-2006 04:10 PM
Re: kill command
So it depends on your situation.
You might kill an vital process with kill -9.
Otherwise you know hte answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:10 PM
01-11-2006 04:10 PM
Re: kill command
# kill -9
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:12 PM
01-11-2006 04:12 PM
Solutionsometime, -9 does have negative impact. The KILL signal does not allow a process to run any cleanup code, which means blasting away with kill -9 may leave child processes of a parent orphaned, temporary files open, shared memory segments active, and sockets busy. This leaves the system in a messy state, and could lead to unanticipated and hard to debug problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:12 PM
01-11-2006 04:12 PM
Re: kill command
try "kill pid" first, if do not succeed, use "kill -9". but make sure u get the correct pid.
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:14 PM
01-11-2006 04:14 PM
Re: kill command
It depend on your need to use -9 with kill command.
Also, refer this link which talks that -9 option in other way;
http://www.speculation.org/garrick/kill-9.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:16 PM
01-11-2006 04:16 PM
Re: kill command
http://sial.org/howto/shell/kill-9/
The KILL signal does not allow a process to run any cleanup code, which means blasting away with kill -9 may leave child processes of a parent orphaned, temporary files open, shared memory segments active, and sockets busy.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:16 PM
01-11-2006 04:16 PM
Re: kill command
THe situation when it is preferred to use kill -9 is
"Use of kill -9 by default may seem acceptable where a known problematic application is involved. However, using the KILL signal by default assumes the problematic process will remain so."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:19 PM
01-11-2006 04:19 PM
Re: kill command
The best approach is to start to kill in this order: -15, -1, -2, -3, -11, and finally and only if it's really necessary a kill -9. You should test for the existence of a process via kill -0 pid between each of these escalating signal. kill -0 pid sets $? to 0 if the PID is still valid.
kill -9 pid is one of those bad techniques that many admins learn but is almost always a bad idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 04:33 PM
01-11-2006 04:33 PM
Re: 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
As Clay said, "-9" is the last weapon.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2006 06:15 PM
01-11-2006 06:15 PM
Re: kill command
As indicated earlier kill -9 should be used at last when other does not seems to work.Sometime even you will find that not even kill -9 works, this will be generally the case when some process has some pending I/O and that is not getting competed due to some failure.
But these sort of scenarios are very rare.
HTH,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 08:42 AM
01-12-2006 08:42 AM
Re: kill command
While using man signal command how to go to directly to the page SIGKILL (9) ?
currently i go by each line and page until i reach there.
Regards,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 08:58 AM
01-12-2006 08:58 AM
Re: kill command
best way is to kill pid to gracefully release all the resources busy by the pid, while for a while and if it's not die kill -9 pid.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 10:00 AM
01-12-2006 10:00 AM
Re: kill command
First try gracefully
i.e
# kill -1 PID
similar to
# kill -HUP PID
If it is not killed gracefully , try killing with SIGKILL signal i.e
# kill -9 PID.
------------------------------------
Here are the detail Signals for kill :
1) HUP 16) USR1 31) RESERVED
2) INT 17) USR2 32) DIL
3) QUIT 18) CHLD 33) XCPU
4) ILL 19) PWR 34) XFSZ
5) TRAP 20) VTALRM 35) bad trap
6) IOT 21) PROF 36) bad trap
7) EMT 22) POLL 37) RTMIN
8) FPE 23) WINCH 38) RTMIN+1
9) KILL 24) STOP 39) RTMIN+2
10) BUS 25) TSTP 40) RTMIN+3
11) SEGV 26) CONT 41) RTMAX-3
12) SYS 27) TTIN 42) RTMAX-2
13) PIPE 28) TTOU 43) RTMAX-1
14) ALRM 29) URG 44) RTMAX
15) TERM 30) LOST
-----------------------------------------
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 02:43 PM
01-12-2006 02:43 PM
Re: kill command
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 05:34 PM
01-12-2006 05:34 PM
Re: kill command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 05:38 PM
01-12-2006 05:38 PM
Re: kill command
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2006 05:40 PM
01-12-2006 05:40 PM
Re: kill command
Kill by default uses signal 15. This will be the same when you do not define any signal.
HTH,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2006 04:53 AM
01-13-2006 04:53 AM
Re: kill command
15 is the default, if you do not specify any signal , 15 is TERM , i.e SIGTERM
hth,
Raj.
---