forked from ezionian/shell-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipv6_dhcp.sh
executable file
·31 lines (26 loc) · 985 Bytes
/
ipv6_dhcp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
while :
do
HOST=google.com
ping -c1 -4 $HOST 1>/dev/null 2>/dev/null
SUCCESS4=$?
ping -c1 -6 $HOST 1>/dev/null 2>/dev/null
SUCCESS6=$?
if [ $SUCCESS4 -eq 0 ] && [ $SUCCESS6 -eq 0 ]
then
echo "$HOST -4 and -6 have replied"
elif [ $SUCCESS4 -eq 0 ] && [ $SUCCESS6 -eq 1 ]
then
echo "$HOST -6 didn't reply"
echo 'goo' | sudo -S systemctl start dhcpcd && sudo dhcpcd -k && sudo systemctl stop dhcpcd && sudo systemctl start dhcpcd
elif [ $SUCCESS4 -eq 1 ] && [ $SUCCESS6 -eq 0 ]
then
echo "$HOST -4 didn't reply"
echo 'goo' | sudo -S systemctl start dhcpcd && sudo dhcpcd -k && sudo systemctl stop dhcpcd && sudo systemctl start dhcpcd
elif [ $SUCCESS4 -eq 1 ] && [ $SUCCESS6 -eq 1 ]
then
echo "$HOST -4 and -6 didn't reply"
echo 'goo' | sudo -S systemctl start dhcpcd && sudo dhcpcd -k && sudo systemctl stop dhcpcd && sudo systemctl start dhcpcd
fi
#EOF
sleep 15
done