diff --git a/LICENSE b/LICENSE index 2071b23..b3ade84 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) +Copyright (c) 2023 | Patrick Asmus - ScriptOS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index d34db4f..98a0acf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ -# fritzbox-restart-script +# Fritz!Box-Neustart-Script +**Script Beschreibung** + +Das Bash-Skript `fritzbox-restart.v1.sh` ermöglicht das Neustarten einer Fritzbox über das TR-064-Protokoll. Das Skript ist kompatibel mit Fritzboxen ab FritzOS 6.0. + +## Verwendung + +1. Stelle sicher, dass du als Administrator auf deinem System angemeldet bist. +2. Öffne ein Terminal. +3. Navigiere zum Verzeichnis, in dem sich das Skript befindet. +4. Führe den folgenden Befehl aus, um das Skript zu starten: + + ```bash + bash ./fritzbox-restart.v1.sh + +Alternativ kannst du den Befehl auch anpassen und direkt im Terminal ausführen. + +```bash +ping -c 1 1.1.1.1 >/dev/null || (for i in {1..3}; do ping -c 1 1.1.1.1 >/dev/null && exit; sleep 30; done; /home/scripts/network/fritzbox-reboot-v1.0.sh) + +Dieser Befehl stellt sicher, dass eine Internetverbindung besteht, bevor das Skript ausgeführt wird. Es versucht, eine Verbindung zum öffentlichen DNS-Server `1.1.1.1` herzustellen und führt das Skript nur aus, wenn die Verbindung erfolgreich ist. Andernfalls wird das Skript erneut versucht, bis die Verbindung hergestellt ist. + +Das Skript sendet über `curl` einen SOAP-Request an die Fritzbox, um den Neustart auszulösen. Die Fritzbox-IP-Adresse, der Benutzername und das Passwort werden in den Variablen `IPS`, `FRITZ_USER` und `FRITZ_PW` festgelegt. Du kannst diese Variablen entsprechend deiner Konfiguration anpassen. + +Bitte beachte, dass du vor der Verwendung des Skripts die Variablen korrekt einstellen und die Ausführungsberechtigungen für das Skript setzen musst. diff --git a/avm-fritzbox.png b/avm-fritzbox.png new file mode 100644 index 0000000..6fdb520 Binary files /dev/null and b/avm-fritzbox.png differ diff --git a/fritzbox-restart.v1.sh b/fritzbox-restart.v1.sh new file mode 100644 index 0000000..2887412 --- /dev/null +++ b/fritzbox-restart.v1.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Script Name: fritzbox-restart.v1.sh +# Beschreibung: startet die Fritzbox neu +# Dieses Bash-Script nutzt das Protokoll TR-064 +# Skript funktioniert für alle Fritzboxen ab FritzOS 6.0 +# Aufruf: ping -c 1 1.1.1.1 >/dev/null || (for i in {1..3}; do ping -c 1 1.1.1.1 >/dev/null && exit; sleep 30; done; /home/scripts/network/fritzbox-reboot-v1.0.sh) +# Aufruf 2 bash ./fritzbox-reboot.v1.sh +# Autor: Patrick Asmus +# Web: https://www.media-techport.de +# Git-Reposit.: - +# Version: 1.0.1 +# Datum: 16.07.2023 +# Modifikation: Header angepasst +##################################################### + +# Variablen +IPS="192.168.178.1" +FRITZ_USER="FritzBenutzer" +FRITZ_PW="FritzPasswort" + +# Ausführung +location="/upnp/control/deviceconfig" +uri="urn:dslforum-org:service:DeviceConfig:1" +action='Reboot' + +for IP in ${IPS}; do + curl -k -m 5 --anyauth -u "$FRITZ_USER:$FRITZ_PW" http://$IP:49000$location -H 'Content-Type: text/xml; charset="utf-8"' -H "SoapAction:$uri#$action" -d "" -s > /dev/null +done