Not working Port reachable script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not working Port reachable script
# 1  
Old 09-17-2010
Not working Port reachable script

Code:
#!/bin/bash

IP=192.168.45.1

telnet $IP 80 >> /dev/null

if [ $? = 0 ]

then

echo "Port is Reachable"

else

echo "Port is not Reachable"

fi

I am tried many times but It's not working at yet..

Kindly help me any one.

Regards,
ThakshinaMoorthy

Last edited by pludi; 09-17-2010 at 08:42 AM..
# 2  
Old 09-17-2010
You can use nmap instead of telnet...

Code:
nmap -p 80 $ip

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script, find the next closed (not in use) port from some port range.

hi, i would like to create a bash script that check which port in my Linux server are closed (not in use) from a specific range, port range (3000-3010). the print output need to be only 1 port, and it will be nice if the output will be saved as a variable or in same file. my code is: ... (2 Replies)
Discussion started by: yossi
2 Replies

2. IP Networking

Port Forwarding not working

Hello Gurus, I have configured port forwarding at router. But after configuration I am not able to connect the computer from outside/Over internet/Remote desktp from other computer. Could you please advice? Thanks- Pokhraj (2 Replies)
Discussion started by: pokhraj_d
2 Replies

3. UNIX for Advanced & Expert Users

Command to check if the server is not reachable using ssh

I have list for servers say server1, server2, server3.....server20 I want to test the ssh connectivity of each server, if any one of the server is down then ssh connectivity fails and the script results something like echo "serever is not reachable" Now I m confused using which command shall I... (2 Replies)
Discussion started by: sam@sam
2 Replies

4. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

5. IP Networking

telnet for port 5433 is not working while it works for port 22

Hi, I am trying to set up a dev environment and I have Ubuntu server (10.16.1.92) and a CentOS VM (10.16.3.235) on this. On the CentOS I have a program running on port 5433. Now my problem is that I am unable to telnet this port from another Windows server whereas I can telnet port 22 from... (5 Replies)
Discussion started by: rishav
5 Replies

6. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

7. Solaris

Sata 2 port not working

I have installed Solaris 11 Express on my machine. On my GA-X58A-UD5 motherboard there are two 6 Gb/s SATA ports (Marvell 9128 chip), but when I connect a hard drive to one of them, the system does not recognize it. However, when I boot from a USB install image (downloaded from here Oracle... (1 Reply)
Discussion started by: RychnD
1 Replies

8. AIX

177 port is up but xmanager is not working in AIX 6.1

Dear Friends, Recently we have to use AIX 6.1 IBM unix server . Here the 177 port is up and also inetd service is up . But we cannot access to the server using X-manager software . server's output : bash-3.00# netstat -nat | grep 177 udp4 0 0 *.177 *.* We have another server AIX-5.3 .... (0 Replies)
Discussion started by: shipon_97
0 Replies

9. Solaris

How i test the UDP port is working?

Hi anybody know how to test out the UDP port working? cos UDP cannot use telnet to test... Sumemr (2 Replies)
Discussion started by: summerpeh
2 Replies

10. UNIX for Dummies Questions & Answers

Port not working

Hi all, I am trying to run a listener through a certain port. The listener starts with no errors but when I do a netstat -n |grep "portNo". It does not show there. I have added the port details into the /etc/services file. If anyone can assist it would be greatly appreciated. Thanks Ryan (6 Replies)
Discussion started by: macgre_r
6 Replies
Login or Register to Ask a Question