Periodically Reboot Veralite

My Veralite will run O.K. for a month or two at a time and then I will have some problem. I would like to periodically reboot my Veralite unit to try to keep it stable and working properly.

Is there a way I can programatically reboot my Veralite? I know I can use a PLEG to schedule it, but what “commands” would I execute to force a reboot?

You can use:

os.execute("reboot")

But you can even add a function to reboot when no internet connection (so it retries the connection):

[code]local ping = os.execute(“ping -c 1 8.8.8.8”)

if ping ~= 0 then
luup.log(“Auto Reboot: Network down. Aborted.”)
else
luup.log(“Auto Reboot: Network OK. Rebooting in 5 seconds.”)
Vera_alert(“Reinicio Vera programado en 10 segundos.”,“none”)
luup.sleep(5000)
os.execute(“reboot”)
end
[/code]

Very nice. Thank you.

Do you have any other “code” that you recommend to keep my Veralite running smoothly?

The following will make youy Vera DEAD consistent.

os.execute("halt")