OpenWrt Forum Archive

Topic: Script to reboot DG834G

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,

I have a DG834v1 with a 2.4.17 kernel that keeps losing all connectivity and needs a reboot to reconnect to the LAN or ISP. PITA !

I want a script that runs on the router , pings 3 hosts, logs faults and reboots when hosts aren't responding.
I found this script http://www.ripserve.com/gpl/ (thanks Ripserve !) but I don't know how to add the things I want.

The pinging works but I have no idea how to get

1) get the faults logged into the Netgear log so I get notified in email. I have klodg and syslogd installed.
2) get the unit to reboot via /bin/reboot
3) run the script after a small delay at startup (otherwise it will keep rebooting before it has time to connect to the Net)

Any suggestions or help is greatly appreciated.

Help :-)
Oichi
___________________________________________
HOSTS=" localhost 192.231.203.132 192.231.203.3"

#!/bin/sh

#       @(#)Ping script by Ripserve
# Version 0.2 Feb 2005
# Released under the GPL
# Usually run via cron, which emails output of errors
# If all is well, you will never see any output from this
# see http://www.ripserve.com/gpl/ for latest version
# BUGS: doesn't work with BSD ping, but linux is fine

HOSTS=" localhost 192.231.203.132 192.231.203.3"

for HOST in $HOSTS
do
    ping -c1 -w1 $HOST > /dev/null
        #suppress output, if host is up

    if [ $? -ne 0 ]
            then
        echo -n "$HOST unreachable on " && date +%d/%m/%Y
                #if there's a problem, print error message, and the date
    else
          logger "ping: $HOST OK"
          #log successfull test to syslog
    fi
       
done

exit 0
____________________________________________________

No help on this script... and the "replacement" firmware still doesn't support wireless.
I suggest using a hammer instead of this "replacement" firmware. Same effect and be quicker.

The discussion might have continued from here.