Public feed
#888281
#!/bin/bash
#Objetivo
# Cambiar la puerta de enlace cuando se caiga, y volver cuando se recupere
#Sintaxis
# nohup script &
R="10.0.0.2"
CESGA="10.0.0.98"
ACTUAL=$CESGA
OTRA=$R
while true; do
sleep 5
if [[ `ping -c 3 $CESGA | grep "100% packet loss"` ]]
then
echo cambia a r
ACTUAL=$R
while [[ x"$ACTUAL" = x"$R" ]]
do
if ! [[ `ping -c 3 $CESGA | grep "100% packet loss"` ]]
then
ACTUAL=$CESGA
echo volvemos a cesga
fi
done
fi
done