User Tools

Site Tools


burim:bash:if_esxi_poweroff
#!/bin/bash


server=$1

ssh -o ConnectTimeout=5 root@$server "exit"
conn_check=$(echo $?)

echo "$conn_check"

if [ $conn_check = 0 ]

  then

   echo "--Log: I can see the ESXI is up and I will poweroff the server"
   echo "--Log: executing poweroff cmd"
   sleep 3s

fi

if [ $conn_check -eq 255 ]

  then

  echo " -- Log: I was no table to connect to the server"
  echo " -- Log: not trying to shutdown the server"

fi

echo " -- Log: Endo of the Script"
burim/bash/if_esxi_poweroff.txt · Last modified: 2018/08/27 14:52 by burim

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki