- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- control 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
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
тАО09-15-2005 03:44 AM
тАО09-15-2005 03:44 AM
control the process
root 15757 0.0 0.0 2352 1196 ? S 17:47 0:00 login -- orcale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 04:03 AM
тАО09-15-2005 04:03 AM
Re: control the process
ps -efl|grep "oracle"|awk '{print $2" "$4}'|grep -v ^D|awk '{ print $2 }'|xargs kill -9
You wrote "orcale", I guess you mean "oracle"...
Regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 04:05 AM
тАО09-15-2005 04:05 AM
Re: control the process
$ ps -auf
ps: unknown user f
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 04:31 AM
тАО09-15-2005 04:31 AM
Re: control the process
your solution is work perfect , but I want to have one more requirement , your script will kill the process with block letter D , but I may be change the process name to other name like "Deve" instead of "oracle" later , so it seems not suit for me . if I want to check the status column , if it is not D , then kill it , how to do it ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 04:34 AM
тАО09-15-2005 04:34 AM
Re: control the process
if I understood your question rightly...
substitute to the command the word "oracle" with the word "Dave"...
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 04:37 AM
тАО09-15-2005 04:37 AM
Re: control the process
do you mean process name = oracle or process userid = oracle ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 04:47 AM
тАО09-15-2005 04:47 AM
Re: control the process
Actually , I will use multi process name in the script , include "oracle" , "Deve" and many many others , so I think it is more accurate if check the process status process . thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 05:02 AM
тАО09-15-2005 05:02 AM
Re: control the process
you can make a while cicle where you launch the command above, substituiting
grep "oracle"
with
grep $name
where $name is the cycled variable containing your process names...
Hope this helps,
Alessandro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 05:05 AM
тАО09-15-2005 05:05 AM
Re: control the process
I am not too understand what is the suggestion , if I simply want to check the status column , could suggest what can I do ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 05:16 AM
тАО09-15-2005 05:16 AM
Re: control the process
I think the solution of pilati itlsef can be modified to get what you are looking for as:
ps -efl|grep "oracle"|grep -v " D " | awk '{print $2" "$4}'|grep -v ^D|awk '{ print $2 }'|xargs kill -9
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 05:22 AM
тАО09-15-2005 05:22 AM
Re: control the process
I think it should be like this:
# ps -efl|grep "oracle"|grep -v " D " | awk '{print $2" "$4}'|awk '{ print $2 }'|xargs kill -9
Trailing and leading spaces for letter D should help you ignore those process. This may not work if your process name itself is D.
Also instead of 'grep "oracle"' you can use 'grep $process_name' and then set this variable according to your requirement.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 05:27 AM
тАО09-15-2005 05:27 AM
Re: control the process
it seems exclude the process that its name contains "D" , is it possible to meet my above requirement ? pls advise ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2005 11:18 AM
тАО09-15-2005 11:18 AM
Re: control the process
If I also want to check if the owner is not "root' and the tty is not "?" , then kill it , can suggest how to modify the script ? thx.
root 15757 0.0 0.0 2352 1196 ? S 17:47 0:00 login -- orcale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2005 12:07 AM
тАО09-16-2005 12:07 AM
Re: control the process
but in my first command, I wrote
grep -v ^D
the "^" character let the command to consider only rows that start with D, so it cannot impact the name of the process.
OK?
Regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2005 12:29 AM
тАО09-16-2005 12:29 AM
Re: control the process
Now you can pipe this through and kill it.
UNIX95= ps -uroot -o pid= -o state=|awk '$2~/S/ {print $1}' | xargs kill -15
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2005 12:32 AM
тАО09-16-2005 12:32 AM
Re: control the process
UNIX95= ps -e -o ruser -o state -o pid -o comm | awk '$1 != "root" && $2 != "D" && $4 == "oracle" {print $3}' | xargs kill -9
$1 != "root" //user is not root
$2 != "D" //state is not D
$4 == "oracle" //command is oracle
You can modify is as you like...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2005 01:39 AM
тАО09-16-2005 01:39 AM
Re: control the process
UNIX95= ps -fC oracle
This is always an exact match to the process name. If you want just the process ID's that match, use something like this:
UNIX95= ps -C oracle -o pid=
Or assign the result to a variable:
ID=$(UNIX95= ps -C oracle -o pid=)
The -o option allows you to select whatever columns you want and you can assign a custom label to the column (-o pid=MyPIDvalue) or you can eliminate the label with pid= and nothing else. If you want 3 columns but no header line over each column:
UNIX95= ps -C oracle -o pid= -o ruser= -o args=
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2005 03:00 AM
тАО09-16-2005 03:00 AM
Re: control the process
Orhan Biyiklioglu's solution seems quite simple and good for me ,
If I want to have one more condition, only kill the process that idle for 30 minutes , could suggest how to update it ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2005 08:32 PM
тАО09-16-2005 08:32 PM
Re: control the process
PS: some points should be appreciated if you find any of the solutions usefull:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-19-2005 03:44 AM
тАО09-19-2005 03:44 AM
Re: control the process
what "heartbeat mechanism" can do it ? what advise the method ? thx