WOL to start PC after power outage?

JimS

Senior Member
I have a linux box with a power supply that doesn't always restart after a short power outage. It restarts fine automatically for longer outages but if it is less than about a second it doesn't. It's my video recorder.  And we sometimes have short outages in the middle of the night and I don't notice the PC is off.

I am thinking I can send a wake on lan signal from another pc to wake it up. So my thought was to write a small script that tries to ping the machine and if it isn't up then send a wol packet. And do that periodically - maybe every hour or 15 minutes or something like that.

It then occurred to me that checking may not be needed. Perhaps I could just send the wol every 15 minutes and if the machine was already running it wouldn't cause any issue and just be ignored.
 
I could write a script but if it is just sending wol I could set that to run in cron on another linux box.
 
Seem like a reasonable plan?  Other ideas?  (the power supply has done this since it was new but wasn't able to return it - otherwise works fine so not looking to replace it).
 
 
 
Here have my Linux server and Windows servers on UPS's.  Two on are USB / serially connected to BSD servers and one is serially connected to a Windows server.
 
Specfically have my combo MythTV / Squeezeserver box running on Ubuntu 18.04 on a UPS.  That said I do not record much with it lately.
 
You can run a python script to send a WOL command (IE: wakeonlan 2.0.1)
 
or if you are using Home Assistant using a WOL plugin or same with Homeseer.
 
PSFSense and OpenWRT also have a wake on lan feature that is part of the OS.

Make sure that the PC in question works with WOL testing it first. I had to modify my tabletop touchscreens NIC bios to work with WOL using a Realtek bios firmware upgrading software. Modifications were switching the BIOS on these devices from EFI (first generation) bios to Seabios (x86). Odd that the network chip on the motherboard had no mac address or OS.
 
Thinking I mentioned that way back I was involved in the initial development of the Fingbox.  (intially developed in Italy then built for distribution in Taiwan - "the Swede".)  I have one sitting here that I never used if you want it.  
 
Turned on wake on lan in the bios and that works.
 
For some reason
sudo etherwake MACID
doesn't work but
sudo wakeonlan MACID
does.  (Think I don't need sudo with wakeonlan)
 
pete_c said:
Here have my Linux server and Windows servers on UPS's.  
 
+1 on using a UPS to smooth out the power hiccups.  Outright outages are bad, but so are under/over-voltage situations.  

Just plan on the UPS batteries being 3-4 year maintenance items.  There's even a Homeseer plug-in now that can be configured to add virtual battery devices to give you a place to track the dates (and issue suitable alerts as the time comes due).

I seem to recall having similar issues with etherwake.  This page mentions a potential reason why:  https://wiki.debian.org/WakeOnLan

Code:
wakeonlan is a program that uses UDP packets not TCP, and hence does not need to be run as root. It is also slightly more configurable.
 
Was going to put a UPS on it but the old ups I was going to use has some issue so I set up cron (on a box that IS on a UPS) to send a wake on lan signal every 5 minutes to it.  Seems to work fine.  If I shut down the DVR it starts back up within a few minutes.  I suppose I should set it up to only be on for recordings and playback but there are a few other things running on it.
 
@JimS,
 
I am assuming you are using MythTV / OTA for your recording device.
 
This past year upgraded my MythTV / LMS box and Zoneminder box over to Lenova's Tiny computers which work well and are low powered machines.  That said I do not record much these days with the MythTV box.  I also replaced the batteries on the Cyberpower 1500 UPS (X3) this past year one at a time.
 
ICS-MythTV-00:~# mythbackend --version
Please attach all output as a file in bug reports.
MythTV Version : v30.0
MythTV Branch : 
Network Protocol : 91
Library API : 30.20181231-1
QT Version : 5.9.5
 
Logitech Media Server Version: 8.1.1 - 1610364019 @ Thu Jan 14 06:22:21 CET 2021
 
I did install Plex Server on the same box and currently have it disabled.
 
I've seen the old Cyberpower 1500's with no batteries on Ebay for $50 these days.
 
Not sure if you are mostly recording OTA stuff.  Here have two HD Homerun tuners that directly connect to the KODI boxes which also record stuff.  You might want to check out the HD Homerun stuff.  The HDHomerun tuners are plugged in to the MythTV box.
 
BTW best HD appears to come from OTA versus Satellite or Cable.  Thinking Satellite / Cable uses a bunch of compression.
 
Yes, MythTV with silicon dust tuner for OTA recording.
 
I need to upgrade to a current version but it works so I haven't...
 
My startup solution is kind of crude I suppose.  I could detect power outage somehow and make it more complicated but it works.  Simpler is better most times.
 
Here also switched from using the old combo amplified RS antenna mounted in the attic to using cardboard UHF non amplified directional antennas.  
 
DIY HD Antennas made from Aluminum foil and cardboard
 
Using old RG6 cable to the attic antenna running down to the basement and connected to the HDHomerun tuners.
 
I have two of these now (small footprint) facing different directions.  The antennas are tacked to the rafters in the attic.

You can get very granular using Nut for Linux relating to power stuff if connecting the UPS to the Linux box that you are using. I had an easier time using a USB cable from the Cyberpower / APC than using a serial cable from the Tripplite UPS.
 
Well...  That failed within a couple days.  I had tested by shutting down the linux PC from the command line and it restarted within a few minutes.  So I considered it good to go and called it done.  Within a couple days we had a brief outage (when I was at work of course) and I told my wife "no problem, it should restart in a few minutes."  Got home and the box is off.  Hmmm.  The board sending the WOL seems to be running ok.  I retested by shutting the PC off and it restarted when it got the WOL signal.  So I pulled the plug for about a half second and plugged it back in.  Then waited for the PC to restart.  It never did. 
 
I have known this power supply has a quirk that it doesn't automatically restart with short outages - done it since new but it was too late for warranty return.  But didn't know it completely quit doing anything.  It does start up after a power glitch if I press the power button though.  Guess it's time for a new power supply or a UPS.
 
What kind of computer is it?  Can you replace the power supply?  
 
I have a few older generic UPS's here that I do not use any more.  I have removed the batteries from them and can ship you one if you want it.
 
Thinking I purchased them from Geeks dot com which is no longer in business.
 
JimS said:
Well...  That failed within a couple days.  I had tested by shutting down the linux PC from the command line and it restarted within a few minutes.  So I considered it good to go and called it done.  Within a couple days we had a brief outage (when I was at work of course) and I told my wife "no problem, it should restart in a few minutes."  Got home and the box is off.  Hmmm.  The board sending the WOL seems to be running ok.  I retested by shutting the PC off and it restarted when it got the WOL signal.  So I pulled the plug for about a half second and plugged it back in.  Then waited for the PC to restart.  It never did. 
 
I have known this power supply has a quirk that it doesn't automatically restart with short outages - done it since new but it was too late for warranty return.  But didn't know it completely quit doing anything.  It does start up after a power glitch if I press the power button though.  Guess it's time for a new power supply or a UPS.
It's been a while since I went digging through these BIOS settings on my PC. But I recall that there was an option to restart after a power failure vs remain off after a failure.  This may not be present in all BIOS versions, but several of my PCs have it.  Have you checked for this?
 
RAL said:
It's been a while since I went digging through these BIOS settings on my PC. But I recall that there was an option to restart after a power failure vs remain off after a failure.  This may not be present in all BIOS versions, but several of my PCs have it.  Have you checked for this?
Thanks for the input - I have that turned on and its been working for a long time but it only sort of works due to power supply issue.  See the first post.  Thus the gyrations to make it work for short interruptions that didn't really fix the problem.  I am getting another power supply which I am pretty sure will solve the issue.
 
Back
Top