Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- SERVERLIST=$1
- if [[ -z $SERVERLIST ]]; then
- cat <<-End-of-message
- server list file not found ...
- usage: ./ivan.sh serverlist.txt
- End-of-message
- elif [[ ! -e $SERVERLIST ]]; then
- echo "File $1 does not exist. Please provide a valid server list filename"
- else
- while read LINE; do
- # for i in $(cat $SERVERLIST)
- # do
- ping -c 1 $i >/dev/null 2>&1
- if [ $? -ne 0 ]
- then
- echo "No response from $LINE"
- else
- ssh -q -o BatchMode=yes -o ConnectTimeout=5 $i >/dev/null 2>&1 exit
- if [ $? -ne 0 ]
- then
- echo "connection not successful in $LINE"
- else
- echo "connection successful in $LINE"
- fi
- fi
- # done
- done < $SERVERLIST
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement