Fritz!Box: shell script to reboot the modem/router

If in your Fritz!Box modem/router is not present an internal capability to reboot the appliance on a specific schedule, you can use an external Linux box connected to it to run a shell script that requests the reboot as you need.

Below a very simple example:

#!/bin/bash

# modem/router ip address | change as needed
IP=192.168.0.1
# modem/router administrator username | change as needed
FRITZUSER="...."
# modem/router administrator password | change as needed
FRITZPW="...."

location=/upnp/control/deviceconfig
uri=urn:dslforum-org:service:DeviceConfig:1
action=Reboot

# if your modem/router is not using https:
# - change :49443 to :49000 
# - change https:// to http://
curl -k -m 5 \
  --anyauth -u "$FRITZUSER:$FRITZPW" \
  -H 'Content-Type: text/xml; charset="utf-8"' \
  -H "SoapAction:$uri#$action" \
  -d "<?xml version='1.0' encoding='utf-8'?><s:Envelope s:encodingStyle='https://schemas.xmlsoap.org/soap/encoding/' xmlns:s='https://schemas.xmlsoap.org/soap/envelope/'><s:Body><u:$action xmlns:u='$uri'></u:$action></s:Body></s:Envelope>" \
  https://$IP:49443$location 

Thanks to Gioxx.org