Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2005 11:23:58 +0530
From:      Anirban Adhikary <anirban.adhikary@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   shell script doesnot executing
Message-ID:  <71c73b070512152153h507fae3eo22e3b2d52df1202f@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
  Hi guys
This is Anirban here. I have the problem again with the previous shell
script.Which was
Write a shell script that will check whether a server is up or not(on ping)
& log the report to a file.

I have tried to write the program in the following way

#! /bin/sh
echo -n "Enter the IP or Hostname of the Server"
read host
#echo $host
ping -c2 $host &>file2
if [ $? =3D 0 ];then
echo "Server is up and working" $host
else
echo"Server is not up and not working" $host
fi

But when I am trying to execute the program in the case when the server is
not up it is showing
The server is up and running but from the ping statistics it is showing tha=
t
100% loss is occured.I am not able to point the problem.(i used the chmod
755 filename before executing the program)

Please help me.And one more thing is there any other option to check the
connectivity without ping command?
 with regards
Anirban



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?71c73b070512152153h507fae3eo22e3b2d52df1202f>