Voici le script qui ne fonctionne pas chez moi
#!/bin/vbash
run=/opt/vyatta/bin/vyatta-op-cmd-wrapper
NEW_IP=`/sbin/ifconfig eth0.832 2>/dev/null | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
if [ -z "$NEW_IP" ]; then
logger -t watchdog -p err "Interface eth1.832 down"
exit 0
fi
# The list of hosts to ping
PING_HOSTS="www.orange.fr www.google.com"
# Reading the default gateway
read _ _ GATEWAY _ <(/sbin/ip -4 route list match 0/0) -----> cette ligne renvoi une erreur , et donc le script ne fonctionne pas
# Pinging hosts, stopping at the first answer
for HOST in $PING_HOSTS; do
logger -t watchdog -p info "Pinging $HOST"
/bin/ping -c4 $HOST > /dev/null 2>&1
if [ $? -ne 0 ]; then
logger -t watchdog -p warn "Failed pinging $HOST"
else
exit 0
fi
done
# If we are here, then nothing is pinging. Try
# the default gateway
/bin/ping -c4 $GATEWAY > /dev/null 2>&1
if [ $? -ne 0 ]; then
logger -t watchdog -p err "Internet connection is broken"
$run renew dhcp interface eth0.832
$run renew dhcp interface eth0.838
fi
Voici l'erreur
orange_watchdog.sh.bak: line 15: syntax error near unexpected token `('
orange_watchdog.sh.bak: line 15: ` read _ _ GATEWAY _ <(/sbin/ip -4 route list match 0/0)'