24h auto rebooting a router with cron
8.8.2020There is an old WDR3600 we have had donated by some kind soul and its 2.4 ghz radio every now and then would conk out, but it is just not broken enough to throw it away. Rebooting it every 24 hours does the trick:
-
crontab -e
-
press
shift+G
to go to the end of the cron job table -
press
i
for text insert mode -
insert this line to reboot the router every night at 3:42 AM:
42 3 * * * sleep 70 && touch /etc/banner && reboot >/dev/null 2>&1
This was initially posted by Jan at Freifunk Winterberg and I thought the line is worth sharing as there is a simple fail-safe option included which essentially prevents the router from accidentally entering a continuous boot-loop caused by a wrong date / time set on the machine. This is a common issue since most routers do not sport an embedded buffered clock and sync their time and date by ntp every once in a while.