Automatisches Neustart script alle 24 oder 48 Stunden (Busybox)

Post Reply
Message
Author
andybreuhan

Automatisches Neustart script alle 24 oder 48 Stunden (Busybox)

#1 Post by andybreuhan »

Hallo,

hoffe ich bin hier richtig.

Habe ein etwas ungewöhnliches Problem und zwar habe ich einen Netgear DG834PNB Router, der mit einem Linux betriebssystem läuft. Leider stürzt bei diesem das internet etwa alle 2 Tage ab. Ich habe danach allerdings noch zugriff über die busybox auf alle systemfunktionen. Also Linux läuft noch. Bei Netgear hab ich schon angerufen, allerdings können die mir im moment noch nicht helfen, das problem sei bekannt und es soll bald eine neue Firmware geben.
Ich wäre daher sehr dankbar wenn mir jemand ein kleines Script sagen könnte, das den router alle 24 oder 48 stunden neustartet.

Ich habe auch ein paar seiten gefunden, auf denen alle dateien die der router hat aufgelistet sind, sind zwar für einen etwas anderen router aber dürfte ähnlich sein.
http://www.suburbia.com.au/~dan/


Als der router einmal abgestürzt war hab ich einfach mal über die busybox "kill 1" eingegeben und dann hat sich der router abgeschaltet nur leider bin ich nicht immer da, um das per hand einzugeben.

edit: ich habe noch den befehl reboot gefunden, jetzt müsste ich diesen befehl ja eigentlich nur noch automatisch 86400sek nach dem booten ausführen lassen.

Hab auch noch was gefunden, aber der author schreibt selbst das das script im moment nicht funktioniert, aber vielleicht ist es ein anfang, brauche es ja gar nicht so komplziert

Script Automatic Reboots

Some DG843 lose LAN and Internet connectivty and need a powercycle to reconnect. This script pings 3 hosts and reboots the router if all 3 pings fail. It also discards logs of succesful pings to /dev/null, saves logs of failed pings to /var/log/timeouts.log, and logs the time of any reboot to var/log/rebooted.log

This ping.sh script is WILL NOT WORK but it is a start.

http://dg834.grandou.net/data/Tipsan...ttach/ping.zip

Download the ping.sh script and edit the IP addresses to ping in the HOST section. Leave the localhost entry and entering your DNS server is a good idea and an external site that responds to pings.
Telnet into your box
Ping the IP address you entered in the ping.sh
wget the script into /the_router/somewhere /that/scripts/go
Test the script works by starting the script sh /path/to/script/ping.sh, wait 10 seconds and unplug your Internet connection. The pings should then fail and the script should reboot the router - watch the lights !
Running the script 24/7 - If the script works as expected we should setup cron up on the box to run the script and monitor our connection 24/7. Some clear cron steps go here ...
Fault tolerance - If there is a problem with your telephone line you don't want your modem to keep rebooting every 3 minutes for hours until the problem is fixed. If the ping.sh script reboots the box three in a 15 minute interval it will stop rebooting the router for an additional 15 minutes and then reboot and reset the reboot counter number in the /var/log/rebooted.log - Sounds fine but I don't know how to do it and I am sure someone must have setup something like this before but I can't find anything.

Improved DG834 logging using syslogd

The DG834 has 2 logging options.
Local logging - all router messages are stored in log file on the router. This file can be auutomatically emailed. The GUI for log filtering and escalation of log messages is poor.
Broadcast logging - The 2nd option is to broadcast log messages via UDP to a syslogd server. The syslogd server will capture the sylogd messages from the DG834 and then analyse the messages, filter, escalate etc etc. MUCH GOODNESS !

Linux users can type "man syslogd" and take care of themselves :-) Windows users might want to install Kiwi Syslog Daemon is a freeware Syslog Daemon for Windows. It receives, filters, logs, displays and forwards Syslog messages and SNMP traps from hosts such as routers, switches, Unix hosts and any other syslog enabled device. http://www.kiwisyslog.com/

You might also want to download the Syslog Generator which sends test syslogd messages to your new syslogd service install.

XP users need to open 1 INCOMING port. Port UDP 514 - you can change the port number in Kiwi Syslog Daemon > File > Setup > Inputs

After installing the Kiwi Syslog Daemon and testing that it works, we need to get the DG834 router to 1) make 2 rules to log everything 2) send/broadcast these log messages to our shiny, new syslogd server. 3) configure the local logs used and stored on the DG834 and send these DG834 logs via email as a backup.

http://192.168.0.1/start.htm and go to the Security Section.

Firewall rules - add and enable 1 rule for OUTBOUND and 1 rule for INBOUND. (How can you change default log level ?)

User avatar
Janka
Posts: 3585
Joined: 11. Feb 2006 19:10

#2 Post by Janka »

Shutdown hat einen eingebauten Timer. Bau in ein Startskript einen shutdown-Aufruf wie z.B. "/sbin/shutdown -r +1d" ein.

man shutdown

Janka
Ich vertonne Spam immer in /dev/dsp statt /dev/null.
Ich mag die Schreie.

Post Reply