#18670: Cron constantly reboots device running openwrt
------------------------------+-----------------------------------
Reporter: azur.muhic@… | Owner: developers
Type: defect | Status: new
Priority: response-needed | Milestone: Barrier Breaker 14.07
Component: packages | Version: Barrier Breaker 14.07
Resolution: | Keywords: cron reboot
------------------------------+-----------------------------------
Comment (by hnyman):
The router has usually no real-time clock. In the boot process the clock
is initially set by "sysfixtime" to the most recent timestamp of any file
found in /etc. At the end of the boot process ntpd starts and fetches the
correct time from internet. You may notice this time jump in the system
log, although ntpd starts so late that there might not be anything in the
log after that.
The most recent file in /etc is possibly a status file, config file or
something, modified maybe 30 seconds before the boot. So, in the boot
process the clock gets set backwards a few seconds to that file's
timestamp. And then cron starts and notices a few seconds later that the
required boot moment has again arrived and reboots again... (ntpd starts
later and it may take a while before ntpd gets and sets the correct time,
so cron may start the reboot in between.)
Alternative solution for cron (instead of disabling sysfixtime like Jow
proposed):
Use a delay in cron and touch a file in /etc before reboot:
# Reboot at 4:30am every day
# Note: To avoid infinite reboot loop, wait 70 seconds
# and touch a file in /etc so clock will be set
# properly to 4:31 on reboot before cron starts.
30 4 * * * sleep 70 && touch /etc/banner && reboot
Related discussion:
https://forum.openwrt.org/viewtopic.php?pid=255592#p255592
https://forum.openwrt.org/viewtopic.php?pid=233054#p233054
--
Ticket URL: <https://dev.openwrt.org/ticket/18670#comment:2>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets