Security PC - Shutdown and (auto) restart

Linwood

Active Member
I had an issue come up during Irma, and am wondering if people have more creative solutions than I can find.
 
I have a security camera setup recording on a PC.  The PC is (physically) beside my ELK security system, and both share a consumer type UPS (Cyberpower), which in turn has a USB connection to the PC.
 
Because the PC draws so much power, I use the UPS to power it only briefly during a power outage (to ride out brief outages) then it shuts down, and the UPS provides relatively long duration for the low power requirements of the ELK (which of course itself has a battery to provide yet longer duration) in the event of a long term outage.  It also powers the network including internet.
 
Here's the issue: Suppose you have a 10 minute power outage.  The PC shuts down, the power comes back on and... nothing.
 
The PC does not auto-restart, because the actual outlet (on the UPS powering it) never lost power.  Consumer grade UPS's, as best I can see, cannot be programmed to shut down individual outlets.
 
The PC can be set to restart on power on (even if shut down, at least the BIOS says it can), but since it never sees a power loss, it just sits there, until a human hits the button.  For Irma the humans were 400 miles away.
 
The PC has a real time clock and can schedule wakeups, so it could wake up every hour -- and have the UPS shut it back down if power is still on.  That's bad in two ways -- doing it frequently consumes a lot of battery if premature and infrequently you miss a lot of time, and if you are doing actual maintenance of some sort, having it wake up all the time if you forget to unplug is a problem.  But it's a possibility.
 
The UPS can be programmed to shut down entirely on outage, so on utility return everything restarts, but this will take the Elk and my network (including internet access) with it.  
 
The other alternative is to put something like a Raspberry Pi somewhere else, NOT on the UPS, which periodically sends a Wake on Lan signal.  With power off it won't send; with power on it should wake up the computer if down.  This is the most attractive if most complex.  I even have a Pi sitting around.
 
But all this seems over-complex.  Is there something I am missing? 

The best I can think is to separate the computer from the Elk/network, which of course costs money, then have the PC's UPS shut down, the network/Elk not.
 
What do others do, or do you have such issues? 
 
 
Curious why you have the Elk on the UPS?  How long will the Elk run on it's batteries after a power failure?
 
Here utilize one 42" Leviton panel next to the OmniPro 2 can.  The Leviton panel powers the modem, one poe switch, regular switch, voip box (and wap).  The Leviton can is on one UPS.  The OP2 is just connected to an outlet. 
 
One drawback of your setup is that the Elk can no longer monitor battery health or power outage/restore.   All you need is a battery the elk has the rest built in, so we are talking $20?
 
Anyway, as far as your question, something like running WoL on your router versus a separate component may work.   If you use DDWRT on your router you can add your automation there to wake your PC.
 
Another option, something like a HA plug in module supported by the Elk, like Insteon, UPB, or X10 for the PC.   Take the Elk off the UPS with a battery so it can detect power loss.  Let it use rules to reset the power module when power is restored.   Or maybe just an AC relay that can be triggered by an Elk ouput.
 
Guessing you are using Nut for your UPS stuff.
 
Googled a couple of solutions:
 
1 - The power came back during the shutdown, but before the UPS power off. Now the UPS does not reboot, and my computer stays off. How can I fix that?
 
There is a situation where the power may return during the shutdown process. This is known as a race. Here’s how we handle it.
 
"Smart" UPSes typically handle this by using a command that forces the UPS to power the load off and back on. This way, you are assured that the systems will restart even if the power returns at the worst possible moment.
 
Contact closure units (ala genericups), on the other hand, have the potential for a race when feeding multiple systems.
 
This is due to the design of most contact closure UPSes. Typically, the "kill power" line only functions when running on battery. As a result, if the line power returns during the shutdown process, there is no way to power down the load.
The workaround is to force your systems to reboot after some interval. This way, they won’t be stuck in the halted state with the UPS running on line power.
 
Implement this by modifying your shutdown script like this:

if (test -f /etc/killpower)
then
/usr/local/ups/sbin/upsdrvctl shutdownsleep 120 # uh oh, we never got shut down! (power race?)
reboot
fi

 
2 - This problem I solved by using one small linux box (Asus wl deluxe or smth) which was plugged into main UPS and wake ASAP as the power was restored. The startup script include a 5 min delay to avoid any variations in power status (up/down), WOL-ed all servers (all w2k3, one linux) and sms me with the status.

 


 
3 - I use NUT (Network UPS Tool) for cases like this. You will need a Unix/Linux based server to monitor the UPS. Once the shutdowns start, it will ensure the UPS is power cycled. This will bring the servers back up if they restart on when power is restored.
 
To some of the above questions: 
 
Why is the Elk on the UPS?  No good reason. It already has a batter (two actually, for separate supplies) and it lasts a reasonably long time.  not sure how long, but hours certainly.  The UPS is really there for the computer, but it seemed silly to waste it.  on the other hand, removing the Elk and having the UPS shut down completely may be a better solution.
 
@wuench, it is monitoring its own batteries' health, and utility power but only if an outage outlasts the UPS.  So I am not sure there is harm (it already has a 15 minute delay if I recall before it reports to the CO a power outage, now it's a few hours (UPS exhaustion) instead.
 
DD-WRT: Already use it, but it's on (another) UPS also, so that doesn't solve the problem of knowing if utility power is on, at least absent a bunch of other scripting to tie it to the UPS.  Which I think could be done. 

But... maybe Pete's question is the really important one -- maybe there's no real purpose in having the Elk also on the UPS, and if it's off, I think shutting down the UPS on sustained outage is the answer (assuming the UPS comes back on with utility power, which I need to test after such a shutdown). 
 
You can also replace the DD-WRT OS with OpenWRT if you want.  Then install NUT, WOL, etc.  You could make the OpenWRT the NUT mothership and have it control the UPS connected to the ZM UPS.
 
Arggg... I realized that the UPS is really also keeping the network up, and I would like it to stay up if possible as if the internet is up, I can still talk to the M1G and check it's status.  Sure, the CO should call, but I really wonder what they did during the hurricane when a couple million alarm systems lost power within a few hours of each other.
 
This needs a bit more thought.  Coming back to the Wake On Lan.  I mentioned I have the Pi, but it's actually already running as a piano music display system, so it would just take a few lines of scripting.   I'm thinking that's the simplest, even though adding a new device makes it implicitly more complicated (I find that when I come back to these things 2 years later, having them simpler is always better for my aging memory, even if I take notes). 
 
OpenWRT - I looked at it once, and didn't think it was as complete as DD-WRT, but did not dig deeply.  Do you like it better?  DD-WRT has been very stable for many years (I upgrade the software every 1-2 years, or when I see a big security update). 
 
Yeah here always used to play around with using DD-WRT.  OpenWRT is opensource and very modular.  I am using one today inside of the OmniPro 2 can.  It is 1" X 2".    That said aside from a UPS nut package there is also a WOL package.
 
Here modified one to have an RTC clock. 
 
The microrouters are all very reasonably priced and they include two NICs and Wireless.
 
Have a look here ==>
Tweaking a TP-Link TL-WR710N & GL.iNet 6416A & Nexx WT1320 MicroRouter
 
Well, I ended up taking the cheap and easy route.
 
I let the UPS shut the PC down.
 
I have a Raspberry Pi that already was in place, that is on utility power.  I set it to wake the other PC every 5 minutes, but obviously it will only do so if the utility power is on.
 
It was extremely complicated to setup in the Pi, it took one whole line in crontab: 
 
 */5 *   *   *   *    /usr/sbin/etherwake  30:85:A9:95:A0:D7 -i wlan0 >> /home/ferguson/etherwake.log  2>&1
 
The etherwake software is packaged and in the (ubuntu mate) distribution as the same name.
 
The only downside is I can't shut the machine down and have it stay down without changing this in the Pi, but it's an always-up machine anyway.
 
Good news Linwood.
 
It is really easy and fast to utilize Linux in command line mode. 
 
It is the GUI (whatever OS) that complicates all of this stuff and creates much un needed overhead and complexity.
 
Today I still have issues with non nonsensical icons that are supposed to mean something in what every OS eye candy there is.
 
Here I make my PFSense firewall overseer / overlord over all all inside of the LAN. 
 
You can also run numerous plugins on an OpenWRT router (smaller than an RPi) these days.  It is just a tight Linux OS.
 
Indeed, Pete.  I still can't configure a Cisco firewall with the GUI, I have to use the command lines, same for routers and switches.  It's one reason I struggle so with Windows at times over simple things, because they HIDE things in the gui.  But at least Powershell is getting more complete.
 
I had a hard time with enterprise Cisco switches and routers and the GUI. 
 
Mostly appeared to me written or conceived by folks that were clueless. 
 
Command line configurations were fast and effortless.  Trying to figure out any logic in the GUI made no sense to me.
 
Back
Top