The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
AIX - Cant ping Netghost AIX 1 10-03-2006 03:38 PM
Ping sam70 UNIX for Dummies Questions & Answers 1 08-02-2005 09:56 PM
ping csaunders AIX 1 04-24-2005 02:54 PM
ping -t jaber87 Shell Programming and Scripting 8 04-17-2004 09:58 AM
About Ping S.Vishwanath IP Networking 4 11-09-2002 06:06 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-12-2002
Registered User
 

Join Date: Sep 2001
Location: Johanessburg
Posts: 27
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
Forum Sponsor
  #2 (permalink)  
Old 12-12-2002
BSeanD's Avatar
Registered User
 

Join Date: Aug 2002
Location: Melbourne, Australia
Posts: 127
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.
  #3 (permalink)  
Old 12-12-2002
Registered User
 

Join Date: Feb 2002
Location: Bradford, UK
Posts: 70
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 11:12 AM.
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0