The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Command/script to find size of Unix Box ? sakthifire Shell Programming and Scripting 6 06-18-2008 03:07 AM
shell script to find files by date and size dadadc UNIX for Dummies Questions & Answers 1 10-20-2007 06:18 AM
Shell script to Find file size ragsnovel Shell Programming and Scripting 1 08-10-2007 11:01 AM
How to find out the stack size occupied for a process? rvan High Level Programming 2 01-24-2007 10:51 AM
How to find the size of Process Address space. S.Vishwanath UNIX for Dummies Questions & Answers 1 07-10-2001 09:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-05-2008
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
find process size script

Hello

i am working on a project here is part of script that i need a help in

get process SpectroSERVER current size if it exceed 3850 MB then
#pkill -TERM ArchMgr
and wait to succfull shutdown message from the log file to proceed to the next step
#tail -f $SPECROOT/SS/DDM/ARCHMGR.OUT
ArchMgr has successfully shut down
if got above message then
# pkill -TERM SpectroSERVER
and wait to succfull shutdown message from the log file to proceed to the next step
#tail -f $SPECROOT/SS/VNM.OUT
SpectroSERVER has successfully shut down
if got above message then proceed to next step
  #2 (permalink)  
Old 08-05-2008
buffoonix buffoonix is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 145
Quote:
get process SpectroSERVER current size if it exceed 3850 MB then
What do you mean by that?
That if the process's resident set size, or virtual size, of it alone,
or including all its children, or those belonging to the same process group etc. exceed this threshold of memory.
What about memory mapped pages or shared memory,
reserved or even used pages on swap?
  #3 (permalink)  
Old 08-05-2008
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
Quote:
Originally Posted by buffoonix View Post
What do you mean by that?
That if the process's resident set size, or virtual size, of it alone,
or including all its children, or those belonging to the same process group etc. exceed this threshold of memory.
What about memory mapped pages or shared memory,
reserved or even used pages on swap?
hello when do top i got the following
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
19202 specadm 29 42 0 3497M 3222M sleep 42.8H 0.00% SpectroSERVER

i need script to check the SIZE if it is > 3850 to proceed
  #4 (permalink)  
Old 08-05-2008
buffoonix buffoonix is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 145
Ah, you were reading top's output.
Then I gather the proc's resident set size is meant,
roughly what the proc used from physical memory.
For that to get you could run a ps command.
Do we know the proc's PID beforehand (maybe from some pid file),
or do we need to parse the proc table first?
Assumed we knew the PID you could run

Code:
$ ps -p <PID> -o rss=

Depends on the ps/OS; on Linux this number should be in KB.
Other ps return number of memory pages.
If you want to check it on a regular basis
you could set up a cronjob which checks every 5 mins or so.
Even better yet would be a monitoring solution like Nagios
(but maybe overkill?)
From the Nagios Plugins you could set up a check command
involving the check_procs plugin.
  #5 (permalink)  
Old 08-05-2008
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
Quote:
Originally Posted by buffoonix View Post
Ah, you were reading top's output.
Then I gather the proc's resident set size is meant,
roughly what the proc used from physical memory.
For that to get you could run a ps command.
Do we know the proc's PID beforehand (maybe from some pid file),
or do we need to parse the proc table first?
Assumed we knew the PID you could run

Code:
$ ps -p <PID> -o rss=

Depends on the ps/OS; on Linux this number should be in KB.
Other ps return number of memory pages.
If you want to check it on a regular basis
you could set up a cronjob which checks every 5 mins or so.
Even better yet would be a monitoring solution like Nagios
(but maybe overkill?)
From the Nagios Plugins you could set up a check command
involving the check_procs plugin.

allright this can be a good start ,, what about rest of the script ?

regards
  #6 (permalink)  
Old 08-05-2008
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
Hello have created script like follwoing ,,, thanks anybody to check and advice

set a=3800000
if [ $a -lt'ps -p `pgrep SpectroSERVER` -o rss=' ]
then
pkill -TERM ArchMgr
b= tail -f $SPECROOT/SS/DDM/ARCHMGR.OUT | grep "ArchMgr has successfully shut down"
if [ $b ='ArchMgr has successfully shut down' ];
then
pkill -TERM SpectroSERVER
fi
c= tail -f $SPECROOT/SS/VNM.OUT | grep "SpectroSERVER has successfully shut down"
if [ $c ="SpectroSERVER has successfully shut down" ]
then sudo /opt/spectrum/lib/SDPM/processd.pl stop
fi
if [ `pgrep processd`]
then pkill processd
fi
procs2kill="LocServer NSAgent telnetd osagent VnmShd"
for proc in `echo $procs2kill`
do
pkill $proc
done
sudo /opt/spectrum/lib/SDPM/processd.pl start
. /home/specadm/spectrum_env ; $SPECROOT/bin/launchinstdbapp `/usr/bin/hostname` SS n VNM.OUT
x= tail -f $SPECROOT/SS/VNM.OUT | grep "is now ready on port 0xbeef..."
if [ $c ="is now ready on port 0xbeef..." ]
then . /home/specadm/spectrum_env ; $SPECROOT/bin/launchinstdbapp `/usr/bin/hostname` ARCHMGR y ARCHMGR.OUT
fi
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0