Beware; when there is no internet connection , it is not good to reboot the vera.
This code first checks if there is internet connection, otherwise it doesn’t reboot.
Before someone made this script for me , once the vera was stuck due to no internet connection after a reboot.
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 2 seconds.")
luup.sleep(2000)
os.execute("reboot")
end
Click schedule and set the interval and click “validate”
Click “Next Step”
Click “Next Step”
Click “No Loop Code Defined” and type in:
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 2 seconds.”)
luup.sleep(2000)
os.execute(“reboot”)
end
and click “Save Lua”
select room and name your scene and click fininsh
But this also means it wont reboot if Google is down “(8.8.8,8)”
On the other hand, one can’t even reboot it remotly if there is no internet
My scheduled reboots are twice a week at 04:00
I just want to be able to reboot every device remotely if I’m away, rarely needed option but still.
And that goes for all internet connected devices: Modem, router, Vera, Alexa, NVR etc.
Now I’m all set with that
Vera contacts OpenWRT NTP servers on a boot—there is no hardware RTC. Vera will be cranky if it can’t contact the time servers. Using a scene to remotely reboot assumes a couple of things: 1) Vera has network connectivity, and 2) Vera is running well enough to accept the remote command.
I use the os.command method for a daily scheduled reboot—you can also use the same scene run manually, of course, to reboot on demand. I run a local NTP server, so outside connectivity isn’t needed to reboot. There are some threads on the forum that cover this topic. For the scheduled reboot, adding the network check code is a must if you don’t run your own NTP. Even so, I use that code to test the NTP server before attempting the reboot.
If Vera isn’t running, then options are obviously limited for a reboot. My Vera’s are on network-connected power relays that ping the units once per minute. If 2 pings are missed, it will power cycle the unit. They can also be controlled from the network, including remotely. All the key network equipment is set up like this.
There are possible downsides to a remote reboot. The forum has some horror stories of folks who had a remote unit fail the reboot, necessitating a long trip to the remote location to debug the problem.
I’m new to this so I’m not sure, but i read a post where somebody had some kind of script that cleared unnecessary files/cache before
scheduled reboot. Some kind of “maintenance”
Don’t know if it’s necessary, but would gladly put that in the reboot lua if it helps Vera function properly.
Like starting from as “clean table” as possible.
The script was: os.execute(“echo 3 > /proc/sys/vm/drop_caches”)
Just dont know if that helps anything, and how to put that in to the rest of the script ?
That would flush a bunch of caches that are volatile, so they’re being flushed by the reboot anyway. Flushing them may have some use if you’re not rebooting, maybe reducing memory use temporarily, but these are well-managed caches and unless you’re really strapped for RAM for some immediate purpose, flushing them is more likely to create a momentary negative impact on system performance.
This cache-flush came from another thread and was apparently recommended by Vera support, at least for one user. Cache management is part of the OS, and as @rigpapa points out, works well. I would not execute this command unless I had a specific situation where I knew it would help. If free memory drops to dangerous levels, the OS OOM (out of memory) killer may start killing processes to preserve the system. Dealing with this sort of behavior is the province of experienced system admins. My systems are VPs, which do have more memory than the VL, VE, or V3, so I may be having a better experience than users on those platforms.
[quote=“thief, post:18, topic:198676”]I have Vera Secure.
What’s the easiest way to see the amount memory used? And system logs?[/quote]
Install ALTUI from the App store. It has built in utilities to show memory and “disk” usage, display logs, search for errors within logs, as well as the ability to run OS commands.
To dump the current log in your browser: http://your_vera_ip_address_here/cgi-bin/cmh/log.sh?Device=LuaUPnP