![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
Quote:
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? |
|
||||
|
Quote:
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 |
|
||||
|
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. |
|
||||
|
Quote:
allright this can be a good start ,, what about rest of the script ? regards |
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|