The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
how to check if a process is running in a server from shell script. debu UNIX for Advanced & Expert Users 2 01-24-2008 05:19 PM
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 06:48 AM
connect to server using ssh tungaw2004 UNIX for Dummies Questions & Answers 0 07-27-2007 10:49 PM
Connect From VB to SQL Server Than Chanroeun SUN Solaris 0 08-04-2006 11:48 AM
i want to pass the connect fd to child process,how can i do ti? hit High Level Programming 6 07-18-2002 02:45 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-25-2008
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
how to connect to server with ssh to check process size

Hello

i have to connect to 11 servers to check the process size on every server.
how to that with shell scripting using ssh

regards
  #2 (permalink)  
Old 08-25-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,322
What do you mean by process size ? However, you can do that easily with "expect" scripting language, have a look at the global net or local forum resources.
  #3 (permalink)  
Old 08-25-2008
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 208
what OS, what process?

for instance on linux (>2.6.9 kernel) you cat look in /proc/<pid>/status for the VmSize line i.e.

$ grep VmSize /proc/1508/status
VmSize: 4404 kB

and via ssh it would be

ssh -l <username> <host> grep VmSize /proc/1508/status
  #4 (permalink)  
Old 08-25-2008
FractalizeR FractalizeR is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 24
I guess one can just issue
Code:
top
command on SSH to check all info.
  #5 (permalink)  
Old 08-25-2008
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
hello

here is the command i am using to get the process size
top | grep SS |awk '{print $6}'| cut -c 1-4

i need to run this command on 11 different servers to grep the process size from these servers

and show it to me
regards
  #6 (permalink)  
Old 08-25-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,421
Quote:
Originally Posted by mogabr View Post
hello

here is the command i am using to get the process size
top | grep SS |awk '{print $6}'| cut -c 1-4
Let's exclude grep and cut:
Code:
top | awk '/SS/{print int($6)}'
  #7 (permalink)  
Old 08-25-2008
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 208
for a start, the top command will fail unless you tell it you want to run it in batch mode, as sshd will not provide a valid $TERM variable.

apart form that something along the lines of :

Code:
for serv in host1 host2 host3
do
echo 
echo $serv
ssh $serv top -n 1 -b |grep SS |awk '{print $6}'| cut -c 1-4
done
should suffice, once you've ensured that the user running the script has passwordless keys setup.

the parameters to top are
-n 1 run 1 iteration and quit
-b run in batch mode, don't look for a terminal
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 06:25 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