commit 175d0ad522914a79e3397e17a328d2666acb230b Author: Nico Hartung Date: Thu Dec 28 13:48:06 2017 +0100 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..eba1110 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bea433 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.DS_Store diff --git a/README.md b/README.md new file mode 100755 index 0000000..751d586 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# FRITZ!Box Neustart Skript - jede Nacht, einmal die Woche, wie ihr wollt + +#### Quick 'n Dirty Scripting | nicht schön, aber selten + +![avm-fritzbox_pressekit.png](avm-fritzbox_pressekit.png?raw=true "avm-fritzbox_pressekit.png") + +Bei diesem Skript handelt es sich um ein klassisches Linux Bash-Skript, welches ich verwende um jeden Freitag, um 4:50, meine 3 AVM FRITZ! Geräte neuzustarten - eine FRITZ!Box und zwei FRITZ!Repeater. + +Folgende Variablen müssen angepasst werden: + + * `IPS` - IP-Adressen der AVM FRITZ! Geräte, können mehrere sein + * `FRITZUSER` - Username der FRITZ! Weboberfläche, kann leer gelassen werden, wenn man nur ein Passwort eingeben muss + * `FRITZPW` - Passwort der FRITZ! Weboberfläche, muss bei allen FRITZ! Geräten gleich sein + +Viel Spaß! + +#### Beispiel + +##### Crontab + +[Wiki-Artikel](https://wiki.ubuntuusers.de/Cron/) zur Crontab auf ubuntuusers.de + +`vi /etc/crontab` + +``` +# FRITZ! Geräte neustarten +50 4 * * 5 root /root/Scripts/cron_fritzbox-reboot.sh +``` + +##### Terminal / Bash + +Natürlich kann man das Skript auch einfach manuell über die Bash / den Terminal jederzeit auführen. + +Beispiel: `./cron_fritzbox-reboot.sh` + +#### Inspiration & Dank + + * [Dragonfly](https://homematic-forum.de/forum/viewtopic.php?t=27994) diff --git a/avm-fritzbox_pressekit.png b/avm-fritzbox_pressekit.png new file mode 100644 index 0000000..6fdb520 Binary files /dev/null and b/avm-fritzbox_pressekit.png differ diff --git a/cron_fritzbox-reboot.sh b/cron_fritzbox-reboot.sh new file mode 100644 index 0000000..79f74a7 --- /dev/null +++ b/cron_fritzbox-reboot.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +####################################################### +### Autor: Nico Hartung # +####################################################### + +# Skript sollte ab FritzOS 6.0 (2013) funktioneren - also auch für die 6.8x und 6.9x +# Dieses Bash-Skript nutzt das Protokoll TR-064 nicht die WEBCM-Schnittstelle + +# http://fritz.box:49000/tr64desc.xml +# https://wiki.fhem.de/wiki/FRITZBOX#TR-064 +# https://avm.de/service/schnittstellen/ + +# Thanks to Dragonfly (https://homematic-forum.de/forum/viewtopic.php?t=27994) + + +###=======### +# Variablen # +###=======### + +IPS="192.168.137.1 +192.168.137.2 +192.168.137.3" + +FRITZUSER="" +FRITZPW="passwort-weboberflaeche" + + +###====### +# Skript # +###====### + +location="/upnp/control/deviceconfig" +uri="urn:dslforum-org:service:DeviceConfig:1" +action='Reboot' + +for IP in ${IPS}; do + curl -k -m 5 --anyauth -u "$FRITZUSER:$FRITZPW" http://$IP:49000$location -H 'Content-Type: text/xml; charset="utf-8"' -H "SoapAction:$uri#$action" -d "" -s > /dev/null +done