- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ps -ef 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
тАО10-08-2001 01:55 PM
тАО10-08-2001 01:55 PM
I have an appliction that orphans it's processes to root and I amd workling on a script to clean them up. Any ideas/ Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:12 PM
тАО10-08-2001 02:12 PM
Re: ps -ef command
Hi,
ps -ef | grep $process | grep -v grep | cut -c 10-14,15-20,39-44 | tr -s " "
This will give outpur of all runaway process.
$process should be replaced by the process name
Good Luck
-USA..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:16 PM
тАО10-08-2001 02:16 PM
Re: ps -ef command
# PIDS=`ps -el|awk '$3 > 100 && $5 = 1 && $12 ~/\?/ {print $4}'`
...will give you a list of candidates. Field-3 is the 'uid' for which you want to return only "safe" *user* processes. Since I start "normal" user definitions in /etc/passwd at 100 and above, I have shown this case. Field-5 is the 'ppid' you seek; and field-4 is the 'pid' you might kill.
If you are going to kill processes, do so with a simple (-15) kill and/or a hangup signal (kill -1) rather than a 'kill -9'. This gives processes a chance to cleanup temporarary files, shared memory and otherwise terminate gracefully.
The capture of your candidate list in a variable like "PIDS" allows you to issue a 'kill -1' for instance; wait 5-10 seconds; and then (if you must), issue a 'kill -9' using the variable list again.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:17 PM
тАО10-08-2001 02:17 PM
Re: ps -ef command
UNIX95= ps -e -o "ppid args"
You can do anything with the output.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:19 PM
тАО10-08-2001 02:19 PM
Re: ps -ef command
Try the following command:
UNIX95= ps -e -o user,pid,ppid,comm |sort -nk3 | more
This will list the processes with the PPID
in the ascending order.
HTH
raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:23 PM
тАО10-08-2001 02:23 PM
Re: ps -ef command
To find out all the processes that has the PPID of 1, use awk to filter the processes
UNIX95= ps -e -o "ppid args" |awk '$1 = 1 {print $2}'
To verify the above output try the same replacing $2 with $0.
BTW UNIX95 gives XPG4 behaviour of PS that is very handy.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:26 PM
тАО10-08-2001 02:26 PM
Re: ps -ef command
1 ) print $1" "$2 }' `
then you can test with
if [[ ! -z $KILL_PID ]];then
......
.....
then to kill you could do..
export TOKILL=`echo $KILL_PID |awk '{print $2}'
kill -9 $TOKILL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2001 02:41 PM
тАО10-08-2001 02:41 PM
Re: ps -ef command
Whatever you do, don't kill these guys with a kill -9 - that is almost always a BAD idea because no cleanup is done (Remove temp files, shared memory, etc.)
I would write a function to kill these guys
with a kill -15, kill -1, kill -2, kill -11 in that order. You can test with a kill -0 to see if the process is still around. kill -11 is almost as sure a kill as kill -9 and does cleanup. It you want to add kill -9 to the end of that list - well that's up to you.