- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Anyone got a script that does something similar ?
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
02-05-2002 05:46 AM
02-05-2002 05:46 AM
I'm looking for a script that basically monitors a process or pid say every 2 mins and checks it's VSIZ values. Once VSIZ gets to XXX Mb, the script forces a "kill -6" on the process or pid and the restarts the process over again ....
any help / suggestions/ pitfalls to look out for appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 05:49 AM
02-05-2002 05:49 AM
Re: Anyone got a script that does something similar ?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 06:41 AM
02-05-2002 06:41 AM
Re: Anyone got a script that does something similar ?
I did not find a way to get VSIZ colum to "ps"
but try this:
LIMIT=1000
while true
do
PID=`cat pid_file`
SZ=`ps -lp $PID | tail -n 1 | awk '{ print $10 }'`
if [ $SZ -gt $LIMIT ]
then
kill -6 $PID
fi
sleep 120
done
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 06:54 AM
02-05-2002 06:54 AM
Re: Anyone got a script that does something similar ?
Volker, I'll give it a go .....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 07:03 AM
02-05-2002 07:03 AM
Re: Anyone got a script that does something similar ?
Use the XPG4 (UNIX95) option of the 'ps' command to find your 'vsz' [kilobytes of physical pages comprising core image].
You can sample the environment as follows:
# UNIX95= ps -e -o pid -o user -o vsz -o comm | k3nr
Note the blank character after the UNIX95 variable and before the 'ps' command. This sets the UNIX95 environmental variable only for the command line. See the man pages for 'ps' for more information.
The output of the above will produce a sorted list in descending 'vsz' size, each line consisting of the 'pid', the 'user', the 'vsz' and the 'comm'and representing the process.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 07:15 AM
02-05-2002 07:15 AM
Solution#!/bin/ksh
# monitor - monitor's a process core size
# run as: monitor pid#
###
# setup #
MAX_CORE=1024 # max size of core image
PID=$1
if [ $PID = '' ]; then
exit 1 # no pid given
fi
CMD="UNIX95= ps -p 8964 -o vsz|tail -1"
# process #
CRNT_CORE=`$CMD`
while [ $"CRNT_CORE" -ne "" ]; do
if [ $"CRNT_CORE" -gt $"MAX_CORE" ]; then
kill -6 $PID
exit 0
fi
sleep 120 # wait 120 seconds
CRNT_CORE=`$CMD` # get new value for next pass
done
exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 08:19 AM
02-05-2002 08:19 AM
Re: Anyone got a script that does something similar ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2002 08:23 AM
02-05-2002 08:23 AM
Re: Anyone got a script that does something similar ?
In /opt/perf/examples/adviser/ there are a few examples, here is one I built and tested, of course you should replace the "exec" line with a script passing the pid that will kill the process and restart the job:
VSSthreshold = 10000
PROCESS loop
{if PROC_MEM_VIRT > VSSthreshold
then
{
exec "echo bad process ", PROC_PROC_ID, " vmem is ", PROC_MEM_VIRT
}
}
note that PROC_MEM_VIRT is in K-bytes, so 10000 is 10mb (10,000,000)
live free or die
harry