Sponsored Content
Top Forums Shell Programming and Scripting need to check whether a sever is pingable or not inside the script Post 302306169 by TonyFullerMalv on Saturday 11th of April 2009 11:00:35 AM
Old 04-11-2009
Code:
for IPADDRESS in 10.0.0.5 192.168.2.5 127.0.0.1; do
  ping -c 1 ${IPADDRESS} >/dev/null 2>&1
  RESULT=$?   
  if [ ${RESULT} -eq 0 ]; then
    echo "INFO: Server ${IPADDRESS} is okay."
  else
    echo "WARNING: Server ${IPADDRESS} is NOT okay."
  fi
done

Result of running the above:
WARNING: Server 10.0.0.5 is NOT okay.
WARNING: Server 192.168.2.5 is NOT okay.
INFO: Server 127.0.0.1 is okay.

Last edited by TonyFullerMalv; 04-11-2009 at 12:06 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running a script on a different Sever

Guys, I want to run a script located on a different server from my pc. Let say the server has an IP of 1.1.10.2/16 and the script path is: /home/user/bin/check.sh The script scans for all available devices on the lan. My pc has an IP of 1.1.15.4/16 and I can ping the sever and can... (3 Replies)
Discussion started by: tony3101
3 Replies

2. Shell Programming and Scripting

script to check for a condition inside a file

Hi I am writing a script file which sends the log files along with their size in a folder named log to a file called temp.log using the following cmd: ls -st 190_GSTV_HUX_003QISCGSK026** >> /home/user/temp.log the temp.log looks like this: 16 190_GSTV_HUX_003QISCGSK026_message070321.log ... (11 Replies)
Discussion started by: kiran1112
11 Replies

3. IP Networking

Serious un-pingable stumper of a problem...

I have been busting my head over a network issue at work recently. I believe the problem to be in the L2 domain, but "the powers that be" believe that it looks more like a server port related problem. And the biggest problem of all is that EVERYBODY in the Engineering Department uses this... (1 Reply)
Discussion started by: jjinno
1 Replies

4. Shell Programming and Scripting

Run command on remote sever from script

I have two redhat linux server. i have created one script which contain some command that run on Local server as well as remote server.I am using this command to connect to remote server ssh user1@192.x.x.x 'command' but when i am running the script in local server it connecting to the server... (1 Reply)
Discussion started by: ranvijaidba
1 Replies

5. UNIX for Dummies Questions & Answers

host not booting, but is pingable

hi there. im having a problem with a host at the moment, i can ping the host and responds with host is alive. i cannot telnet, rsh or anything else to it... it tells me connection refused. when i run a ckport on it i get answers from : *** successful - smtp *** successful - sunrpc ... (6 Replies)
Discussion started by: brian112
6 Replies

6. Shell Programming and Scripting

Check condition inside the loop

Hi, I am in trouble. I can get inside my condition test inside a loop : I am in ksh (solaris) while read file do <commande to retrieve file> >> ${LOG_RETRIEVE_FILE.log} msg_err=$(cat ${LOG_RETRIEVE_FILE.log} | grep "error retrieve") if ; then <sendmail> exit 1 fi done I tried... (6 Replies)
Discussion started by: Aswex
6 Replies

7. Solaris

[Help] - 2 VM solaris pingable

Hi, I have 2 VM of Solaris ( 2nd one full clone ) 1st VM - 192.168.1.30 2nd VM - 192.168.1.31 My need : ping both VM from each other I have added host entry in /etc/hosts of both server but unable to ping each other from solaris console... Pls advice (4 Replies)
Discussion started by: saurabh84g
4 Replies

8. Shell Programming and Scripting

validating(pingable or not) remote ip address in shell script

i need to verify whether the ip adress given as input to the shell script is pingable or not... that is whether the ip is alive and responding.. ping $ip_adress the above wont work in script because the execution is continuous... so the shell script keeps will dwell in this pinging process...... (8 Replies)
Discussion started by: vivek d r
8 Replies

9. Shell Programming and Scripting

Linux Shell Script to check for string inside a file?

This is what I have so far grep -lir "some text" * I need to check all files on the system for this text, if the text is found I need to change the file permissions so only ROOT has read and write access. How can this be done? (3 Replies)
Discussion started by: mapleleafs89
3 Replies

10. Shell Programming and Scripting

Script to check the files existence inside a directory.

Hello Folks, On Below Script, I want to apply condition. Condition that it check the directory for files if not found keep checking. Once directory have files and founded do the calculation and finish the code. Script to check the files existence inside a directory, If not then keep... (16 Replies)
Discussion started by: sadique.manzar
16 Replies
MSGCACHE(8)						      System Manager's Manual						       MSGCACHE(8)

NAME
msgcache - Cache client messages for later pickup by hobbitfetch SYNOPSIS
msgcache [options] DESCRIPTION
msgcache implements a Xymon message cache. It is intended for use with clients which cannot deliver their data to the Xymon server in the normal way. Instead of having the client tools connect to the Xymon server, msgcache runs locally and the client tools then deliver their data to the msgcache daemon. The msgcache daemon is then polled regularly by the hobbitfetch(8) utility, which collects the client messages stored by msgcache and forwards them to the Xymon server. NOTE: When using msgcache, the BBDISP setting for the clients should be BBDISP=127.0.0.1 instead of pointing at the real Xymon server. RESTRICTIONS
Clients delivering their data to msgcache instead of the real Xymon server will in general not notice this. Specifically, the client con- figuration data provided by the Xymon server when a client delivers its data is forwarded through the hobbitfetch / msgcache chain, so the normal centralized client configuration works. However, other commands which rely on clients communicating directly with the Xymon server will not work. This includes the config and query commands which clients may use to fetch configuration files and query the Xymon server for a current status. The download command also does not work with msgcache. This means that the automatic client update facility will not work for clients com- municating via msgcache. OPTIONS
--listen=IPADDRESS[:PORT] Defines the IP-address and portnumber where msgcache listens for incoming connections. By default, msgcache listens for connections on all network interfaces, port 1984. --server=IPADDRESS[,IPADDRESS] Restricts which servers are allowed to pick up the cached messages. By default anyone can contact the msgcache utility and request all of the cached messages. This option allows only the listed servers to request the cached messages. --max-age=N Defines how long cached messages are kept. If the message has not been picked up with N seconds after being delivered to msgcache, it is silently discarded. Default: N=600 seconds (10 minutes). --daemon Run as a daemon, i.e. msgcache will detach from the terminal and run as a background task --no-daemon Run as a foreground task. This option must be used when msgcache is started by hobbitlaunch(8) which is the normal way of running msgcache. --pidfile=FILENAME Store the process ID of the msgcache task in FILENAME. --logfile=FILENAME Log msgcache output to FILENAME. --debug Enable debugging output. SEE ALSO
hobbitfetch(8), xymon(7) Xymon Version 4.2.3: 4 Feb 2009 MSGCACHE(8)
All times are GMT -4. The time now is 07:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy