Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.64 KB | None | 0 0
  1. #!/bin/sh
  2. SERVERLIST=$1
  3. if [[ -z $SERVERLIST ]]; then
  4.   cat <<-End-of-message
  5.   server list file not found ...
  6.   usage: ./ivan.sh serverlist.txt
  7. End-of-message
  8. elif [[ ! -e $SERVERLIST ]]; then
  9.   echo "File $1 does not exist. Please provide a valid server list filename"
  10. else
  11.   while read LINE; do
  12.     status=$(ssh -n -o BatchMode=yes -o ConnectTimeout=5 -i ./.vagrant/machines/node`echo $LINE | awk -F. {'print $4'}`/virtualbox/private_key vagrant@$LINE 2>&1)
  13.       if [ $? -ne 0 ]
  14.       then
  15.           echo "connection not successful in $LINE"
  16.       else
  17.           echo "connection successful in $LINE"
  18.       fi
  19.   done < $SERVERLIST
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement