Register
It is currently Tue Jul 29, 2014 10:47 am

port check on two servers


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Apr 30, 2013 10:37 pm   

Joined: Tue Apr 30, 2013 9:51 pm
Posts: 1
Hello all,

First of all, so glad to find this forum :)
Second of all, would you guys mind to help me solve this problem:
I had an assignment to check specific port on two different server, here's the condition:
Server1: check [telnet localhost 80] --> output 1
check [telnet server2 80] --> output 0 ==> do nothing

check [telnet localhost 80] --> output 0
check [telnet server2 80] --> output 1 ==> do nothing

check [telnet localhost 80] --> output 0
check [telnet server2 80] --> output 0 ==> start httpd on server1


Server2: check [telnet localhost 80] --> output 1
check [telnet server1 80] --> output 0 ==> do nothing

check [telnet localhost 80] --> output 0
check [telnet server1 80] --> output 1 ==> do nothing

check [telnet localhost 80] --> output 0
check [telnet server1 80] --> output 0 ==> start httpd on server2

where output 1 means the port is listening and output 0 the port is not listening
please help, very newbie in shell scripting :D

Thanks in advance


Top
 Profile  
 PostPosted: Thu May 02, 2013 6:12 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
Code:
lsof -i :80

Can help to determine if a service is up.

You'll need to have a go at writing a script and then we'll help you resolve issues you encounter.

It's not often on this forum that someone will just write a script for you.

DW


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP