ping


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ping
# 1  
Old 12-12-2002
ping

Hi there hope list can help

I'm looking for a command that does the following

lets say i ping a server 00.00.000.00
and this server is up and running how do i get the ping command to return a UP or a Down

meaning
if the command is true do this
if the command is False do this

Regards
Nemex
# 2  
Old 12-12-2002
I'm not sure its as easy as that. I remember when I was using Linux I was able to block pings being returned giving the impression the machine was down/non-existant. I'm guessing you can do that in almost any OS.

You'd want to scan a system with something like nmap, if your using Unix, but of course that sort of thing is frowned upon if it's not your own machine. Smilie
# 3  
Old 12-12-2002
To see if a ping has worked, check the return value ($?)

ie. something like
Code:
ping -c1 <server_name>
if [ $? -ne 0 ]
then
    echo "Not Found"
else
    echo "Found
fi

added code tags for readability --oombera

Last edited by oombera; 02-17-2004 at 03:12 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

2. Shell Programming and Scripting

How to get reason for ping failure using perls Net::Ping->new("icmp");?

Hi I am using perl to ping a list of nodes - with script below : $p = Net::Ping->new("icmp"); if ($p->ping($host,1)){ print "$host is alive.\n"; } else { print "$host is unreacheable.\n"; } $p->close();... (4 Replies)
Discussion started by: tavanagh
4 Replies

3. IP Networking

PING

I am unable to ping my remote server.My server is unable to ping the same. both are able to ping the gateway. both the ip's are on same network.i use a proxy tunnel on my remote server.Help if any clues. (6 Replies)
Discussion started by: oslbhavana
6 Replies

4. Shell Programming and Scripting

Animation Ping on Solaris Like Cisco Ping

Hi, I develop simple animation ping script on Solaris Platform. It is like Cisco ping. Examples and source code are below. bash-3.00$ gokcell 152.155.180.8 30 Sending 30 Ping Packets to 152.155.180.8 !!!!!!!!!!!!!.!!!!!!!!!!!!!!!. % 93.33 success... % 6.66 packet loss...... (1 Reply)
Discussion started by: gokcell
1 Replies

5. IP Networking

Can't Ping

I have an old MP-Ras Unix system. I have setup netowkring but am unable to ping any local network pcs or the default gateway. If i use the arp -a command I receive the correct mac address for all connected pcs but I cannot ping anything except the local address. Any help would be appreciative. ... (7 Replies)
Discussion started by: Rutgerncas
7 Replies

6. Linux

Not able to ping

Hi All, Need your help one more time. I am trying to ping a linux machine which is not responding to ping. However traceroute can reach the machine and I can log in to it by ssh. I have checked /proc/sys/net/ipv4/icmp_echo_ignore_all it is already set as "0". It is not happening in the... (1 Reply)
Discussion started by: ailnilanjan
1 Replies

7. IP Networking

can't ping by ip

hi, I m trying to ping ip on the network . The machine is started but i can't access and can't ping it .. But when i restarts that machine that works fine..... can anybody have an idea about this problem ?? if then reply .. thanks (2 Replies)
Discussion started by: tahir23
2 Replies

8. UNIX for Dummies Questions & Answers

Ping

Hi , I have one system installed on Linux Red Hat 3.0. I have ip of system 3.156.168.*** and i want to ping some port that is on this IP which command i can do this? sam70 (1 Reply)
Discussion started by: sam70
1 Replies

9. AIX

ping

We can ping out but the return never comes back even to localhost ping localhost PING loopback: (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0 ms it just sits there.... any ideas, any files to check (1 Reply)
Discussion started by: csaunders
1 Replies

10. IP Networking

About Ping

Hi, When I pinged a machin, I got to be seen a different kind of reply from that machine. This is as below : "Reply from 136.128.11.116: Source quench received." Which I felt like an un-usual message. So what does this mean. Regards & Thanks in advance. Vishwa. (4 Replies)
Discussion started by: S.Vishwanath
4 Replies
Login or Register to Ask a Question