Making a Linux home server sleep on idle and wake on demand (2023)
106 comments
·September 2, 2025t_mahmood
M95D
Why don't you send WOL directly over the internet? (You'll need to set up a permanent ARP record on the router.)
Or login into the router and send WoL from there?
Or have Raspberry always on with ssh?
Or set a power-on timer in BIOS/UEFI once a day and a shutdown/sleep in cron? (This is also a good failsafe if WoL doesn't work.)
t_mahmood
> Why don't you send WOL directly over the internet? (You'll need to set up a permanent ARP record on the router.)
Hm, so never tried something like that before actually, I think for OpenWrt I need to install arp packages. I do not have public IP any more though, was getting hammered by bot network and found Tailscale to do what I need.
> Or login into the router and send WoL from there?
Restricted outside access to the router management panel, only port forwarded to the desktop.
> Or have Raspberry always on with ssh? I do not have one, which is why used a mobile, thought to be next best thing. As, power outages happen regularly, I need something that would be able to keep on running.
> Or set a power-on timer in BIOS/UEFI once a day and a shutdown/sleep in cron? (This is also a good failsafe if WoL doesn't work.)
That's easily workable for my setup, actually!
Thank you for giving me the ideas!
M95D
>> Why don't you send WOL directly over the internet? (You'll need to set up a permanent ARP record on the router.)
> Hm, so never tried something like that before actually, I think for OpenWrt I need to install arp packages.
No, you don't. Put this in /etc/firewall.user or /etc/rc.local (you can do it from UI) and forward a UDP port to 192.168.0.254 or whaterver subnet you're using:
ip neigh add 192.168.0.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br-lan extern_learn
The incoming packet will be broadcasted (ff:ff...) on the br-lan interface. 192.168.0.254 doesn't need to exist - the sleeping computer doesn't care.synergy20
I don't think BIOS/UEFI can do power-on timer unless it's server-class hardware? Have not looked into PC BIOS/UEFI for a while.
For failsafe, KVM might be the ultimate solution in case boot got stuck.
benplumley
Since you're already using Tasker, you could use it to launch Tailscale on the phone at boot - I've got mine set to do this so my phone reconnects to tailscale after a reboot.
t_mahmood
Now I have another mobile with more control, so restart is not a problem anymore, and as I can SSH in to it using Termux. This basically handles all of my needs.
Now I just need to get enough momentum to set up the process of waking up my desktop as needed and set up radical caldav server in the mobile.
teekert
You worked with what you had and understood, it was beautiful.
I for one just leave the beast on, I understand that spin-ups and downs are the main thing that wreck harddrives (and my beast has a lot.)
bjt12345
Some motherboards disable power to their ethernet port upon sleep and so WoL will not work.
This is particularly common if the NIC is a power hungry 10GbE port.
However, in the particular case I found, the motherboard also disables oower to any usb GigE adapter attached.
The solution I found was to attach a USB hub with (empty) SD slots and integrated GigE port. As SD cards require power to remain mounted, the motherboard did not shutdown power to this adapter and WoL worked.
M95D
There's a "EuP 2013" setting in the BIOS/UEFI. Disable that.
If you use Windows, check in device manager for a setting to allow the device to wake up the computer. (I can't remember the exact name.)
threatripper
This reminds me of the empty box in a corner of the workshop with the written note "Don't remove!".
leandrosa81
20 years ago, I used to have a Linux server running Slackware at home, that would wake up the two PCs we had at home to back up their data if they were turned off. If they were already turned on, they would send a WOL packet to the Linux server to turn it on in case the that server was off, and then start the backup routine. And the last one would tell the Linux server to turn-off itself. It used to work really great, good times.
jll29
Not as sophisticated as your solution, but works with all hardware for the "backup use case": use a mechanical timer set to 10 minutes before backup starts (and power off 30 minutes after backup normally ends):
https://www.amazon.de/Mechanical-Analogue-Switching-Christma...
It's a more rigid solution that doesn't let you ssh in (unless during backup time ;-), but it saves electricity and it is implemented in 10 minutes (5 for an Amazon order and 5 to plug in and set the timer to your backup hours). It's also a more robust solution - little can go wrong (the only thing is you need to balance backup time against electricity/time savings as backup size grows).
slug
Or just suspend to RAM on backup finish/time and use wake on RTC alarm (and set to turn on after power return on power failure if needed), no need for extra HW.
InfamousRece
My server stays powered off but will boot on receiving wol packet. It’s not a sophisticated set up but works for me. I have an always on Rpi running tailscale. I can ssh to it and send a wol from there. Once my server boots I can ssh to it and run the script to mount its data disks - they are encrypted so I need to type a passphrase. Quite a bit of work but I don’t have to do it often.
privatelypublic
Well done. But note: you can grab an ATX control board, or configure the RPi as a USB Gadget to wake the machine via power button or keyboard.
bjackman
I did this recently as I was struggling to get WoL to work with my consumer PC. It seems like this ultra low-level stuff is a total crapshoot so if you can dodge it by just wiring up the power button, that's a good option.
In in the end I just went the whole hog and set up a PiKVM, so now if I mess up the machine's networking (or even completely break the OS) I can still recover it remotely even though it doesn't have a proper BMC or anything like that.
In general this approach seems ugly in principle but I really like it in practice. It lets you retrofit solid remote capabilities onto consumer hardware. That way you have such a broader market to buy from.
privatelypublic
I'm absolutely excited for the nanoKVM-PCIe. They were out of stock last I looked, but they've released the firmware source as promised.
btschaegg
Note: If you're going to use an SBC _only_ for wake up signals, you might want to look into alternatives for the RPi such as the Radxa RockPi S [1]. My home server, for example, runs continuously at 7W, which beats many RPi models. Of course, a Pi to wake things doesn't need that much power and could be an older model, but even then, you'd still be burning "empty Watts".
Of course, the RockPi doesn't give you any KVM like functionality, though.
privatelypublic
Yea, technically an esp32 board with ethernet would work for this job. They're typically limited to 10mbit, but if you have 10mbit/s of broadcast traffic you can afford something better.
fulafel
Apparently RPi Zero idles at 0.4 W: https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-p...
spaceywilly
This seems like a smart option, that would also allow power cycling the machine remotely I’m assuming, in case it goes totally out to lunch.
holri
Thank you for the post, very informative. I do this half manually. I have a cgi script on the always on very power efficient sbc server that wakes up the bigger server if someone needs it. The big server powers itself down when no backup is running at a time everybody using the server usually sleeps. I thought about improving this and measure server usage and solar power generation to decide the shutdown, maybe with an additional warning email. for example: "The server shuts down in 5 minutes due to no demand and no solar power, if you want to prevent this click this link: http://server.lan/cgi-bin/keepalive "
nottorp
Most of the time you don't need data center sized home servers even if you do test data center sized software solutions on them.
So instead of the Pi solution, how about using a server that idles at 10-20 W?
danieldk
This. My Lenovo ThinkStation with a Core Ultra 7 265K idles out at ~10W headless (measured with a smart plug), while it can be very fast when needed.
antov825
That's what I was thinking too. My home server consumes like 15 W and is silent. If you get a rack mounted server made for data centers and stick it in a closet so you can't hear it then yes, i guess this approach makes sense.
marcosscriven
In the UK, every 10W of 24/7 load is ~£25/year (33 USD).
It’s very easy for even the small things to add up.
kqr
In contrast to many common consumer subscriptions which start at double that it seems like decent value.
Spooky23
I use a Mac Mini. When nothing it up, it draws like 7W!
ryandrake
How do you accurately measure how much current a PC is drawing at any given time? Do you have some kind of measurement device inline with the power cord?
PeterStuer
Yes, I have one of those for my homelab. I draw about 200W on average, but it can spike to about 1000W.
https://www.brennenstuhl.co.uk/en-GB/products/travel-adapter...
drnick1
You can use "smart" plug such as the Sonoff S31 (flash ESPHome to make it cloud-free).
Spooky23
I have it plugged into a IKEA smart plug.
01HNNWZ0MV43FF
https://en.wikipedia.org/wiki/Kill_A_Watt
Works good IME, but you have to plug it into the wall first. Sometimes if you plug the appliance in, and then plug the KAW in, it will miscalibrate
pmontra
I considered doing something like that but eventually I went for the simpler solution of plugging my little servers into smart plugs. I shut them down, then power off the plug over wifi. I start them by powering on the plugs. The plugs draw very little power. The servers are ARM SoC and draw 1 to 4 W. One of them has an HDD that draws about 10 W but I can unmount and power off it when I don't need that disk and I still need the server on (it's also got a SSD.)
Liftyee
Sounds like a neat setup - can you self host the smart plug control (Home Assistant?), or do they connect to third party servers?
flobosg
(2023), discussed at the time: https://news.ycombinator.com/item?id=35627107
dang
Thanks! Macroexpanded:
Making a Linux home server sleep on idle and wake on demand – the simple way - https://news.ycombinator.com/item?id=35627107 - April 2023 (237 comments)
hs86
This reminds me of this old plugin for Windows Home Server: https://www.green-it-software.com/products/lights-out-for-wh...
You could set a calendar schedule for waking up itself and backing up the clients, and at night the server would go into standby only if no clients were running anymore since X minutes.
Ha ha, I tried something similar when I had to go to Thailand for my wife's treatment. And failed spectacularly. Fortunately, my laptop had all the files. I didn't have Tailscale at that time.
My Desktop, WoL on, tested to be working Android Phone, always on
All have SyncThing installed. Mobile had Tasker installed.
So, the idea was to have Tasker monitor a folder inside SyncThing, When I need my computer, I put a file inside that folder, when Tasker finds that folder, it sends WoL to my desktop, and deletes the file, Computer wakes up. When I see the file deleted I know, the beast is now awakens ....
When I actually did try that from Thailand, the file did not got deleted, nor the beast woke up.
What happened? Turns out, my mobile restarts automatically after some time of inactivity. Which, locks Tasker out, and the whole process fails.
So, operation wake the beast was busted.