#!/bin/sh # wireless watchdog. ################## Watchdog1 start ############################# nasstatus=`pidof -k nas` # process watchdog. This program will check processes status and # restart processes if a process is not running, or status is zombie, # Since we use ps and grep to check if a process is running, # we need to check if the grep result is the grep process itself # status="" means the process is not running # status=Z means the process becoming zombie if [ "$nasstatus" = "0" ]; then /var/etc/wl.sh fi ################## Watchdog2 start ############################# wl0status=`wl -i wl0 bss -C 0` # wl0 watchdog. this program will check wl0 status, and if status is down then restart wl0. # If (GUI wireless - basic - Enable Wireless = enable) and (# wl -i wl0 bss -C 0 is down) # restart wlan (ifconfig wl0 down && ifconfig wl0 up). #wl0status=up or down if [ "$wl0status" = "down" ]; then ifconfig wl0 down ifconfig wl0 up echo "== restart wireless ==" >> /var/wlrec.log date >> /var/wlrec.log echo "==" >> /var/wlrec.log fi exit