PB script avec redirection
Bonjour,
J'essaie de mettre en place un script testant ma connexion wifi et redémarrant le réseau si je ne ping pas la passerelle :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#!/bin/bash
COUNT=4
GATEWAY=192.168.1.1
count=$(ping -c $COUNT $GATEWAY | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') > /dev/null 2>&1
if let $count 2>/dev/null; then
if [ $count -eq 0 ]; then
date >> /root/log/reseau.log
ifup wlan0 >> /root/log/reseau.log 2>&1
/usr/lib/vmware/net-services.sh restart >> /root/log/reseau.log
fi
else
date >> /root/log/reseau.log
ifup wlan0 >> /root/log/reseau.log 2>&1
/usr/lib/vmware/net-services.sh restart >> /root/log/reseau.log
fi |
Lorsque je lance manuellement
Code:
1 2
|
#./script.sh > /dev/null 2>&1 |
tout fonctionne avec comme sortie écran :
Code:
1 2 3
|
bridge-wlan0: is a Wireless Adapter
bridge-wlan0: is a Wireless Adapter |
Par contre quand je positionne mon script en crontab, le réseau ne se relance pas ????
Code:
*/10 * * * * /root/script/script.sh > /dev/null 2>&1
Merci d'avance pour votre aide.