All pastes #389465 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-10 19:10 UTC
rendered paste body
#!/bin/bash


 
isAlive()
{ 
  for i in $*; do
     printf "GET /\n\n" | nc $i 80 > /dev/null 2>&1 && return 0
  done
  return 1
  
}

 gwAuxInUse=false
  

 while : ; do
   isAlive google.com123
   alive=$?

   
   if   [ $alive -eq 0 ] && $gwAuxInUse; then
        echo "cambiando a primario"
        gwAuxInUse=false
   elif [ $alive -eq 1 ] && ! $gwAuxInUse ; then
        echo "cambiando a secundario"
        gwAuxInUse=true
   fi       
 

sleep 10
done