- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Secure OS Software for Linux
- >
- Re: Script for monitoring hang 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-27-2004 11:59 PM
тАО01-27-2004 11:59 PM
I just started to read/learn scripting for linux and find it very interesting. Now i'm trying to monitor a process that always hangup on my linux and perhaps kill it by running a script under cron.
see my attachment...
from there, when i run a top command it shows me that bash process under user1 takes up a lot of process which causes my linux hang.
I wonder whether anyone can suggest how to write a script for this or perhaps share your scripts if happens that you already have one.
Appreciate anyones help.
Bong
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-28-2004 12:10 AM
тАО01-28-2004 12:10 AM
Re: Script for monitoring hang process
This should kill the first instance of any
Derek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-28-2004 01:19 AM
тАО01-28-2004 01:19 AM
Re: Script for monitoring hang process
Rather than kill off hung processes, I would suggest it is more important to determine why the thing is hanging or hogging CPU in the first place. I would be interested in your example to know exactly what "user1" is doing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-28-2004 09:43 AM
тАО01-28-2004 09:43 AM
Re: Script for monitoring hang process
Don't write stop-gag's to get *around* issues.. Fix the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-28-2004 02:07 PM
тАО01-28-2004 02:07 PM
Re: Script for monitoring hang process
Agree with both Mark & Stuart, of course I need to find out what causing this bash hang. But as of the moment, at least make a temporary solution for this.
Bong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-28-2004 02:27 PM
тАО01-28-2004 02:27 PM
SolutionUsing the 6th column (C) in the output of 'ps -elf' is by var the easiest way to go.
When the system is in it's bad state, check tos ee what the 'C' column is doing in a ps output.
To continually monitor it, a simple routine similar to this should suffice:
while sleep 5
do
ps -elf | awk '{
if ($6 > 250) {
system("kill -HUP " $4);
}
}'
done
The two arbitary numbers are the 5 in the 'sleep' (how long between checks), and the 250 in in the awk's if statement (whatever is a bad value from your ps checks earlier).
.. just an idea atleast ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2004 10:35 AM
тАО01-30-2004 10:35 AM
Re: Script for monitoring hang process
The next time you see the problem, try using `ps -ef` and follow the parent/child process numbers (or see if `pstree` can give you enough info) to see what's causing this problem.
You could write a script to kill a bash shell if it reaches a certain percentage value, but you run the danger of killing something you might not have wanted to be killed.