Means to check if some process is running on "n" number of machines | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Means to check if some process is running on "n" number of machines

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-25-2013
msgforsunil msgforsunil is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 28 October 2014, 11:47 AM EDT
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Means to check if some process is running on "n" number of machines

Team,

I would like to know, if we have any command in Solaris to verify, if some process is listening on a port on a set of machines.

for eg: Wrote the below script, and found that when a process is listening on that port, then it just waits there and doesnt come out. Rather, I would like the script to verify, if some process is listening on that port on that machine and then come out with appropriate message and process to verify a port on the next machine.

telnet abc 33
telnet xyz 405
telnet bbb 54

Do we have any other alternative? Does lsof be useful? Please let me know on this.


Thanks
Sunil Kumar
Sponsored Links
    #2  
Old 01-25-2013
GP81 GP81 is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 13 January 2014, 7:20 AM EST
Location: Warsaw, Poland
Posts: 65
Thanks: 0
Thanked 14 Times in 13 Posts
First exchange ssh keys with all those servers and then:

Code:
# ssh root@abc "netstat -a -f inet -P tcp | grep '.33 '" | awk '{print $NF}'
# ssh root@xyz "netstat -a -f inet -P tcp | grep '.405 '" | awk '{print $NF}'
# ssh root@bbb "netstat -a -f inet -P tcp | grep '.54 '" | awk '{print $NF}'

Above should return word "LISTEN"
Of course you can add some 'if' in script which will return true or false depends of what is the returned word.
Sponsored Links
    #3  
Old 01-25-2013
msgforsunil msgforsunil is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 28 October 2014, 11:47 AM EDT
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Can I exchange the keys using a script with multiple machines? If yes, then can you please tell me how?

I dont want to login to SSH, rather just check, if its running on the remote machine, since I am not aware of the user credentials.

Thanks
Sunil Kumar
    #4  
Old 01-25-2013
GP81 GP81 is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 13 January 2014, 7:20 AM EST
Location: Warsaw, Poland
Posts: 65
Thanks: 0
Thanked 14 Times in 13 Posts
If you don't want to use ssh, then you can try nmap.
Sponsored Links
    #5  
Old 01-26-2013
msgforsunil msgforsunil is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 28 October 2014, 11:47 AM EDT
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Hi GP,

Can you please tell me as how to exchange ssh keys with all those servers using a script, without user intervention?

Thanks
Sunil Kumar
Sponsored Links
    #6  
Old 01-26-2013
RudiC RudiC is online now Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 31 October 2014, 8:45 AM EDT
Location: Aachen, Germany
Posts: 4,480
Thanks: 74
Thanked 1,097 Times in 1,033 Posts
Exchanging ssh keys is a one off exercise; there's no reason nor benefit for a script.
Sponsored Links
    #7  
Old 01-26-2013
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 30 October 2014, 11:42 PM EDT
Location: Paris
Posts: 4,434
Thanks: 16
Thanked 474 Times in 427 Posts
Quote:
Originally Posted by msgforsunil View Post
I would like the script to verify, if some process is listening on that port on that machine and then come out with appropriate message and process to verify a port on the next machine.

telnet abc 33
telnet xyz 405
telnet bbb 54

Do we have any other alternative?
Depending on the protocol, this might work:

Code:
read foo < /dev/tcp/abc/33  && echo port  33 is open on host abc
read foo < /dev/tcp/xyz/405 && echo port 405 is open on host xyz
read foo < /dev/tcp/bbb/54  && echo port  54 is open on host bbb

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to check number of "CPU physical and core"? arm_naja Solaris 5 06-09-2011 05:43 AM
What "-a" operator means in "if" statement aoussenko Shell Programming and Scripting 1 03-02-2011 10:30 AM
How to check "faulty" or "stalled" print queues - SAP systems? newbie_01 Solaris 0 07-15-2010 09:40 AM
script running with "ksh" dumping core but not with "sh" simhe02 HP-UX 9 11-04-2008 07:52 PM
Command to find out "count" of running process ? MITESH KOTHARI Shell Programming and Scripting 4 04-01-2008 03:27 AM



All times are GMT -4. The time now is 08:46 AM.