Sponsored Content
Top Forums Shell Programming and Scripting Shell script to ping multiple servers Post 302993948 by MadeInGermany on Thursday 16th of March 2017 02:56:25 PM
Old 03-16-2017
I guess you have an empty line in your list.
The following discards empty lines and #comments and trailing space characters:
Code:
#!/bin/bash

date
while read output junk <&3
do
  case $output in
  "#"*|"")
  ;;
  *)
    ping -c 1 "$output" > /dev/null
    if [ $? -eq 0 ]; then
      echo "node $output is up"
    else
      echo "node $output is down" | mailx -s "$output not pinging" xyz@klm.com
    fi
  ;;
  esac
done 3< /var/tmp/servers.list

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

script to ping servers

Hi , I would like to automate a script to ping all the unix servers perodically thru cronjob. Is there any script out there? If so Please give me. Thanks in advance. (2 Replies)
Discussion started by: sriny
2 Replies

2. Shell Programming and Scripting

Prevent wrong user from using shell script for multiple remote servers

Hi, I am running a shell script from a central server to multiple remote servers using the following code: application_check() { # Linux/UNIX box with ssh key based login SERVERS=`cat /tmp/server-details` # SSH User name USR="user" # create new file > /tmp/abc.log # connect... (2 Replies)
Discussion started by: mystition
2 Replies

3. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

4. Shell Programming and Scripting

Ping the hostname of many servers using a script

Hi We have some 300 servers in the Data center and some of them are running with AIX and some of them are running with Solaris. I need a script which can be run in one of the server and that script should ping the hostname of all the 300 servers. Also the script should notify if any server is... (9 Replies)
Discussion started by: newtoaixos
9 Replies

5. Shell Programming and Scripting

run vi/vim encrypted shell script without decryption on multiple servers

Hello Everyone, How do we run vi/vim encrypted shell script without decryption on multiple servers. It is a simple bash script and vim -nx <filename> has been used to encrypt with desired password. Now I have few errors, the syntax is absolutely fine as I have run that script multiple times on... (0 Replies)
Discussion started by: lovesaikrishna
0 Replies

6. Shell Programming and Scripting

Shell script to connect to multiple ssh servers

Hello, I have access to several linux servers (mostly centos based) located in a DC in another country. from day to day I need to login to each of them to do some work (they dont have gui/window manager installed, I work only from console), or even to just do a check like df -h for disc usage.... (3 Replies)
Discussion started by: MaRiOsGR
3 Replies

7. Shell Programming and Scripting

Script to Ping Servers

Hey, It's me again! Still trying to learn to become a better scripter on the job :) New challenge for assistance, if anyone cares to help, and its two parted! First part, I wanted to create a script at work that would ping a server that was supplied in an argument, then a count (amount of times)... (5 Replies)
Discussion started by: gkelly1117
5 Replies

8. Shell Programming and Scripting

Ping script to list of servers

Hi Friends, I have experience in redhat/ Ubuntu OS, but I am very new to solaries os. my servers OS is Oracle Solaris 10 8/11 s10x_u10wos_17b X86. I have a file contains 200 servers IPs one by one. now I want a script to chaeck which IPs are pinging, not pingning. I... (8 Replies)
Discussion started by: kumar85shiv
8 Replies

9. Shell Programming and Scripting

Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team, Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail. Need this script to check reachability of multiple nodes at same time. Help me. I use this but not working... Eg. in this script i need to telnet... (4 Replies)
Discussion started by: Ganesh Mankar
4 Replies

10. Shell Programming and Scripting

Shell script for connecting multiple servers and then copying 30 days old files

Shell script for connecting multiple servers and then copying 30 days old files from those server . HI , I have 6 multiple servers pla1,pla2,pla3,pla4,pla5,pla6 1. These six servers have common shared mount point /var/share 2. Running script from /var/share to connect these servers.I... (1 Reply)
Discussion started by: rcroyal88
1 Replies
DSHBAK(1)						      General Commands Manual							 DSHBAK(1)

NAME
dshbak - format output from pdsh command SYNOPSIS
dshbak [OPTION].. DESCRIPTION
The dshbak program formats pdsh pdsh output for humans. Output from each node is consolidated, the leading "node:" is stripped, and a header block with the node name is added. If the -c option is specified, nodes with identical output are not displayed twice; instead, the header will contain a list of nodes. The list of nodes is further compressed into node ranges if the node names have a numeric suffix. OPTIONS
-h Display a summary of command line options. -c Do not display identical output from nodes twice. Instead, print the list of nodes with matching output in the header block. -d DIR Write consolidated node output to separate files in output directory DIR. Any existing files will be overwritten. -f With -d, force creation of specified DIR. ORIGIN
A rewrite of IBM dshbak(1) by Jim Garlick <garlick@llnl.gov> on LLNL's ASCI Blue-Pacific IBM SP system. SEE ALSO
pdsh(1) http://pdsh.googlecode.com 2011-02-26 DSHBAK(1)
All times are GMT -4. The time now is 05:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy