Logic Machine Forum
Scripted Reboot - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Scripted Reboot (/showthread.php?tid=2796)



Scripted Reboot - BrentW - 18.08.2020

Hi,

Is it possible to perform a unit reboot from within a script.
i.e. a scheduled reboot every 3 weeks?

Brent


RE: Scripted Reboot - admin - 18.08.2020

Why do you want to reboot periodically?


RE: Scripted Reboot - BrentW - 18.08.2020

(18.08.2020, 06:33)admin Wrote: Why do you want to reboot periodically?
On all of my automation projects I like to implement this function as a safe guard against failures at inopportune moments.
Experience has told me that the most common errors occur at the reboot and as such I like to conduct controlled cycles.

BW


RE: Scripted Reboot - Daniel - 19.08.2020

This command will reboot the controller. Make sure you don't create infinite reboot loop.
Add some delay before the command in scheduler script to make sure it won't run again after reboot.
Code:
os.execute("reboot")

Normally this is not needed.


RE: Scripted Reboot - Erwin van der Zwart - 19.08.2020

Hi Daniel,

Will this “os” command also force a save to the SD card?

If not you will end up with gaps in your trending.

As you stated: The system is designed for 24/7 operation so reboots are not needed..

FYI: I installed a LM2 - yeah believe it or not (: - in our office (behind a UPS) in 2013 and it has never rebooted sinds then and still running like a charm with quite some scripting, so this is a reliable benchmark if you ask me (: 

It’s also never upgraded and i don’t think i will ever do that, so let’s see if it runs another 7 years (:

If Petr reads this i suspect i have a HW3 suprise soon (:

BR,

Erwin


RE: Scripted Reboot - Daniel - 20.08.2020

Hi Erwin
Yes it does save, it's like you would press the button in the interface.
BR