- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Killing 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
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
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
08-21-2002 10:58 PM
08-21-2002 10:58 PM
I have a problem with users leaving a process behind if the application crashes. Once left behind this process chomps up cpu. The problem I have that a nightly job has the same process name so I need a script that will kill a process with the process name being mdb_x.27831 owned by any other username than qbdba.
The process is able to run for users other than qbdba but not for any longer than 60 minutes
I hope that makes sense.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:02 PM
08-21-2002 11:02 PM
Re: Killing process
The user whybroja should be killed
29896 whybroja 241 run 1563:34 98.81 98.64 mdb_x
13842 qbdba 148 20 5:13 10.26 10.24 mdb_x
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:12 PM
08-21-2002 11:12 PM
SolutionEasy.
PID=$(ps -ef|grep mdb_x|grep -v grep|grep -v qbdba|awk '{print $2}')
Gives you the pid number to kill. It greps out the process owned by qbdba so if you have a runaway this will find it, then if the pid is non null kill it;
[ "$PID" -ne "" ] && kill $PID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:18 PM
08-21-2002 11:18 PM
Re: Killing process
There are several good threads about how to go about killing processes. Example : http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xc8d7a135f587d5118ff00090279cd0f9,00.html
I found this thread by doing a search on the forums with keywords : "kill grep process".
Hope it helps,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:21 PM
08-21-2002 11:21 PM
Re: Killing process
Thanks and I will assign points shortly!
This process can run for a time of about hour before you know that its a zombie.
How do I allow it to check that its been running for 60min + before killing it?
Cheers
Darren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:21 PM
08-21-2002 11:21 PM
Re: Killing process
You can try this:
for i in $(ps -ef | grep "mbx_x*"| grep -v -e "qbdba" -e "grep" |sed -e 's/^/ /g' -e 's/\ \{1,\}/#/g' | cut -d"#" -f3)
do
echo $i
done
If all works, change the "echo $i" by "kill $i"
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:30 PM
08-21-2002 11:30 PM
Re: Killing process
This script looks for running heavy cpu time users of a particular type and Zaps them.
The line:-
if [ $cpu00 -gt 180 ] - sets the cpu usage before the kill is activated ??? adjust to suit.
It is not the tidiest script but it works.
Test it well before use and echo back results before unhashing the Kill line.
HTH
Paula
------------------------cut here--------------
# CONNECTION MONITORING /CONTROL #
###########################################################
#!/usr/bin/sh
# Get info on the users
# Change the grep to suit particular user
#
ps -ef | grep " mdb_x.27831" | grep whybroja | grep -v grep | awk '{print $2, $5, $7}' | while read pid time cpu
do
# Strip the ':'
cpu00=`echo $cpu | sed 's/://'`
time00=`echo $time | sed 's/://'`
time000=`echo $time00 | sed 's/://'`
currenttime=`date "+%H%M%S"`
#
# Calculate total time connected
timeon=`print $currenttime - $time000|bc`
echo $timeon
#
# CPU usage bit
# Cpu usage limit
if [ $cpu00 -gt 180 ]
then
# Gracefull kill
echo $pid
# kill $pid
# Stronger kill (If required)
# sleep 5
# kill -9 $pid
fi
done
------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2002 12:17 AM
08-22-2002 12:17 AM
Re: Killing process
Welcome to the forum.
Paula