#!/bin/bash
while [ true ]; do
if ping -c 1 -w 1 google.com > /dev/null; then
echo "Ste Pripojený, spúšťam nekonečnú čakaciu smyčku";
## Nekonečna smyčka
if ! ping -c 1 -w 1 google.com > /dev/null; then
echo "Chyba";
iwlist wlan0 scan
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "xxx"
dhclient wlan0
hamachi -c /etc/hamachi stop
sleep 1
hamachi -c /etc/hamachi start
sleep 6
hamachi -c /etc/hamachi list
ip a
sleep 5;
if ! ping -c 1 -w 1 google.com > /dev/null; then
echo "Chyba pri pokuse obnoviť pripojenie, opakujem ";
iwlist wlan0 scan
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "xxx"
dhclient wlan0
hamachi -c /etc/hamachi stop
sleep 1
hamachi -c /etc/hamachi start
sleep 6
hamachi -c /etc/hamachi list
ip a
# exit;
else
echo "Pripojenie obnovené";
fi
fi
sleep 5
else
echo "Pokus o spojenie";
iwlist wlan0 scan
#!/bin/bash
while [ true ]; do
if ping -c 1 -w 1 google.com > /dev/null; then
echo "Ste Pripojený, spúšťam nekonečnú čakaciu smyčku";
## Nekonečna smyčka
if ! ping -c 1 -w 1 google.com > /dev/null; then
echo "Chyba";
iwlist wlan0 scan
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "xxxx"
dhclient wlan0
hamachi -c /etc/hamachi stop
sleep 1
hamachi -c /etc/hamachi start
sleep 6
hamachi -c /etc/hamachi list
ip a
sleep 5;
if ! ping -c 1 -w 1 google.com > /dev/null; then
echo "Chyba pri pokuse obnoviť pripojenie, opakujem ";
iwlist wlan0 scan
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "xxxx"
dhclient wlan0
hamachi -c /etc/hamachi stop
sleep 1
hamachi -c /etc/hamachi start
sleep 6
hamachi -c /etc/hamachi list
ip a
# exit;
else
echo "Pripojenie obnovené";
fi
fi
sleep 5
else
echo "Pokus o spojenie";
iwlist wlan0 scan
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "xxx"
dhclient wlan0
hamachi -c /etc/hamachi stop
sleep 1
hamachi -c /etc/hamachi start
sleep 6
hamachi -c /etc/hamachi list
ip a
echo '?'
fi
done