LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-09-2010, 05:39 AM   #1
saurabhmehan
Member
 
Registered: Jul 2010
Posts: 44

Rep: Reputation: 0
Question HELP Using telnet command in shell script


I want to test connectivity between different servers using telnet.
I have Name,IP List and port in one file. Please help how i can test connectivity is successful or not?

File format will be:
Name1,127.0.0.1,80
Name2,127.0.0.2,8080

Output could be
Name1, Successful
Name2, Unsuccessful


I have prepare the code which uses curl and execute complete URL which is as follows:
for url in $(awk -F"," '{print $3}' cp_urls.txt)
do
curl -s -o "/dev/null" $url
if [ $? -eq 0 ] ; then
echo "$url = running"
else
echo "$url = not running"
fi
done
But i want to test connectivity between IP and port number specified.
Please suggest.
 
Old 08-10-2010, 01:00 AM   #2
tlowk
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Slackware
Posts: 182

Rep: Reputation: 25
you could use the netcat command (sometimes nc)
The version I have has even a command for this
see man nc:
" -z zero-I/O mode [used for scanning]"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to automate TELNET daggulasreedhar Programming 5 08-02-2007 12:13 PM
can we telnet the system using shell script suchi_s Programming 18 02-18-2005 02:43 PM
PB launching shell-script with telnet Naurore LinuxQuestions.org Member Success Stories 1 08-04-2003 07:42 AM
PB launching shell-script with telnet Naurore Linux - Newbie 1 08-04-2003 04:45 AM
telnet login via shell script lethe Linux - General 8 05-13-2002 09:31 AM


All times are GMT -5. The time now is 02:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration