- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to kill all the process
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
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
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-29-2010 12:18 PM
тАО01-29-2010 12:18 PM
how to kill all the process
how we can kill all the process at a time?
how we can identify the parent process?
how we can close the multiple session in HP-UX.
below are the login session for this "test" user.
-------------------
User tty login@ idle JCPU PCPU what
test pts/ta 10:50am 1:08 -ksh
test pts/tb 1:18pm 30 -ksh
test pts/tc 1:19pm -ksh
test pts/td 1:44pm more -s
---------------
how we can these session at a time?
please help on this . thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 12:37 PM
тАО01-29-2010 12:37 PM
Re: how to kill all the process
The 'ppid' of a process is its parent pid.
If you wanted to find all processes belonging to a user (e.g. "unixguy") you can do:
# UNIX95= ps -u unixguy -o pid,ppid,comm
Notice that there is a space without any semicolon after "UNIX95=" before the 'ps' command. This sets the XPG4 (or 'UNIX95') behavior only for the duration of the command line since setting it can have side-effects for other commands that you may not want or know.
Now if you wanted to kill all of these do:
PIDS=$(UNIX95= ps -u unixguy -opid=)
for HOW in 1 15 9
do
kill -${HOW}
sleep 2
done
Never begin with a 'kill -9' since it cannot be trapped by a process and thus the process has no chance to cleanup temporary files or remove shared memory segments. Instead, use an escalating series of hammers.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 12:51 PM
тАО01-29-2010 12:51 PM
Re: how to kill all the process
In some secomds:
>ps -fu username | awk 'NR>1{system("kill -9 " $2)}'
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 12:58 PM
тАО01-29-2010 12:58 PM
Re: how to kill all the process
"PIDS=$(UNIX95= ps -u unixguy -opid=)
for HOW in 1 15 9
do
kill -${HOW}
sleep 2
done"
maybe I missed something here, but how is the PID getting to the kill command??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 01:01 PM
тАО01-29-2010 01:01 PM
Re: how to kill all the process
Oops! [ Thanks, OldSchool ]. The suggested code should look like:
PIDS=$(UNIX95= ps -u unixguy -opid=)
for HOW in 1 15 9
do
kill -${HOW} ${PIDS}
sleep 2
done
...I forgot to use the list I created!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 02:50 PM
тАО01-29-2010 02:50 PM
Re: how to kill all the process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 03:05 PM
тАО01-29-2010 03:05 PM
Re: how to kill all the process
You can kill the ppid of the user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2010 10:05 PM
тАО01-29-2010 10:05 PM
Re: how to kill all the process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-31-2010 11:01 PM
тАО01-31-2010 11:01 PM
Re: how to kill all the process
fuser -ck