Quote |
while [ 1 ]; do sleep 60 if ! ping -c2 router 2>&1 | grep ttl; then reconnect here fi done |
Code Sample |
#!/bin/bash while [ 1 ]; do sleep 60 if ! nslookup 192.168.0.1 | grep 192.168.0.1 > /dev/null 2>&1; then if ! ifconfig | grep eth0; then /sbin/ifconfig eth0 up > /dev/null 2>&1 fi route add default gw 192.168.0.1 /etc/init.d/networking restart > /dev/null 2>&1 && if ps | grep cupsd > /dev/null 2>&1; then /etc/init.d/cupsys restart > /dev/null 2>&1 fi if ps | grep smbd > /dev/null 2>&1; then killall /usr/sbin/smbd /usr/sbin/smbd fi if ps | grep mt-daapd > /dev/null 2>&1; then killall mt-daapd mt-daapd -y fi #--etc,etc,etc-- else sleep 5 fi done |
Code Sample |
$ sudo /sbin/ifconfig eth0 up $ sudo /etc/init.d/networking restart |