Making a Linux home server sleep on idle and wake on demand (2023)

136 AgaoAnar 56 9/2/2025, 7:42:48 PM dgross.ca ↗

Comments (56)

leandrosa81 · 2h ago
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.
privatelypublic · 5h ago
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 · 2h ago
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.

spaceywilly · 41m ago
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.
hs86 · 1h ago
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.

antov825 · 6h ago
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.
Spooky23 · 5h ago
I use a Mac Mini. When nothing it up, it draws like 7W!
ryandrake · 1h ago
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?
Spooky23 · 10m ago
I have it plugged into a IKEA smart plug.
drnick1 · 1h ago
You can use "smart" plug such as the Sonoff S31 (flash ESPHome to make it cloud-free).
Arnavion · 31m ago
And for one-off testing there's the standard P3 Kill-a-watt.
flobosg · 5h ago
(2023), discussed at the time: https://news.ycombinator.com/item?id=35627107
dang · 2h ago
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)

ape4 · 3h ago
Use `powerprofilesctl set power-saver` to set to a low use profile
its-kostya · 1h ago
Well done. I really enjoy blog posts that dive into topics that probably cross the minds of most home lab-ers at one point or another.
Neil44 · 4h ago
I would be tempted to try using the Pi as a router & firewall with the server on another subnet, having it wake the server using traditional WOL as needed. That feels simpler to me and more controlled. But my overall feeling is that not much power is saved here overall compared to a well set up server. Good project though quite educational.
dipierro · 1h ago
This sounds very similar to Apple’s DNS-SD Sleep Proxy Services.
tgma · 1h ago
Indeed. Frankly, that would be a nice standardized solution to your machine register itself on a Bonjour Sleep Proxy and can be cheaper than Pi with a used AppleTV off of eBay.
drnick1 · 4h ago
All this complexity to save a few bucks per year on your electricity bill? This is ridiculous, the Pi costs far more than what you can be expected to save.
neilv · 3h ago
I think it turned out a lot more complicated than the author expected, but that their solution they kindly wrote up will be pragmatic for someone.

(For example, imagine a big home GPU server that is needed only intermittently, and you want it to spin up automatically on network traffic from family's various devices that you can't modify.)

Of course, if you have simpler needs, and you're willing to send a WOL magic packet from the using devices, you can do in a few lines of shell script. It's a 1-line ssh-to-something-that-can-etherwake-on-that-vlan script, then wait in a loop for the service you need to appear, then 1-line ssh-to-server-to-shutdown when you're done.

daymanstep · 3h ago
In many European countries electricity is quite expensive. In the U.K. for example, running 20 watts nonstop for a year will cost you around $65 on a typical tariff. If you have more than one home server the savings can quickly add up.
bjackman · 2h ago
Also 20W is fairly low for idle draw right? Like I think you can get proper machines down that low if you know what to look for but most stuff bigger than a mini PC is gonna be drawing 40+? I might be slightly miscalibrated though.

Anyway it's not about the money for me it's any the aesthetics. Burning power for nothing is yucky.

Edit: just been Googling around. OP is running one of these HP mini PCs. They are pretty efficient! Some go well below 10W. So yeah I would say for the specific use case it's unlikely to matter very much. But still it's a useful thing to be able to do in general.

zbrozek · 24m ago
My home server is a pig and draws about 100 watts idle.
esseph · 3h ago
Are you a programmer by chance? Some are, and they enjoy it!

I know a lot of sysadmins / platform engineer types. A lot of them really enjoy the mix of hardware and software integration challenges.

bongodongobob · 3h ago
I don't know any sysadmins who would do this. Task scheduler for Windows or rtcwake for Linux. We try to reduce complexity with existing battle tested tools, not create whatever this is. This is definitely not the easy way.
esseph · 9m ago
Ah, you're not a tinkerer!
Havoc · 1h ago
> a few bucks per year

Crunched the numbers for mine - about 150 bucks a year in potential savings.

righthand · 1h ago
Not sure where you are but energy bills are sky rocketing in the US.
sneak · 2h ago
The old saying: Linux is only free if your time is worth nothing.
2OEH8eoCRo0 · 5h ago
Have you measured the power consumption of your "high power consumption" server?
ThatPlayer · 2h ago
Mine idles at around 130W from the walls. I think it's mostly the hard drives, maybe the SAS controller. I've migrated a few services to a miniPC and started turning it off too.

The main issue for me is the heat. I've got it next to me and 130W of heat adds up in the summer.

BizarroLand · 3h ago
My home server setup when running at full tilt consumes approx 160 watts iirc.

I'd love it if I could turn off my systems for when I really need them.

2OEH8eoCRo0 · 3h ago
Do you usually run it full tilt? What's it typically using on average? I've forgotten how much mine averages, I only remember being surprised how little it sips because it's mostly idle.

It's surprising because reddit (and HN) would make you think you're throwing away tons of money unless you go with some tiny ARM board and that's not true.

jeffbee · 5h ago
Seriously. You can get running states around 1W these days.
shellwizard · 2h ago
Are you talking about processor's C-states? My old 6th gen i3 stays most of the time idling around C8, averaging 5w, really impressive, I suppose newer gens will be even more efficient
jeffbee · 1h ago
C8 is a good state if you can get it. Intel is really good at this. They don't even bother energizing the L3 caches immediately when exiting deep package C-states. But there are lots of conditions that will inhibit C8, notably an Ethernet link on a NIC capable of PTP. This is why wireless is better.
macawfish · 3h ago
supertrope · 35m ago
If one can afford a GPU with a MSRP of $1999 and was scalped for $2999 during the initial craze, you are probably not struggling to pay your electric bill.
moandcompany · 1h ago
You can use nvidia-smi to set a target maximum power draw and performance mode to bring idle power levels down. Also make sure your computer is using the server/headless mode driver to keep idle power consumption down.
jeffbee · 3h ago
I suggest not putting a ridiculous GPU in your backup server.
overfeed · 14m ago
Not everyone's "home server" is a backup server - some are for AI experiments.
wiredpancake · 3h ago
Running states around 1W? How?
supertrope · 32m ago
1W is a unicorn as just plugging in a power supply with no PC parts hooked up will register 1W. <10W is more realistic. Select a PC that can run off a laptop charger. Check manufacturer spec sheets for the idle power consumption. Don't install any PCIe cards or hard drives. Use powertop --autotune.
dragonwriter · 29m ago
> Select a PC that can run off a laptop charger.

(looking at my 330W laptop charger)

I’m not sure that is the constraint you think it is.

supertrope · 28m ago
To be more specific a 65W or 90W laptop power supply.
jeffbee · 2h ago
Only put the RAM you need in the box, use peripherals with working ASPM, attach them to the northbridge PCI ports instead of the CPU's root ports, use wireless instead of wired networking, and don't attach a display.
wiredpancake · 1h ago
I do basically all of that, CPU idles around 5% but still consumes over 100W. (Minus the Wireless part)

(5800X + 64GB)

I can enable Eco Mode in the BIOS, which will bring down the CPU to about 65W max although its still at about 100W total system.

supertrope · 29m ago
Chiplet based Ryzen CPUs inherently have higher idle power draw. Monolithic chips like 5600G have lower idle power draw. The motherboard, power supply, and internal peripherals all need to be carefully selected to get a really low idle figure.
jeffbee · 1h ago
Whatever software you are using is totally, utterly broken. Not sure what else I can tell you. Even a completely decked out Ryzen AI Max Pro 395 idles at 5W in Windows S0 (see: https://h20195.www2.hp.com/v2/getpdf.aspx/c09133726.pdf)
Western0 · 4h ago
for ideal I need port knocking for wake up
hsbauauvhabzb · 57m ago
Nothing to stop you setting that up on the secondary device to trigger the listen/wake scripts, but if someone malicious is on your local network and has permission to trigger WOL, chances are you have bigger issues.
blibble · 2h ago
any half decent router will allow you to create static arp entries for another host

no need for a standin

craftkiller · 1h ago
Yep, here is the page for it on FreshTomato (the firmware the author switched to): https://wiki.freshtomato.org/doku.php/basic-static#static_ar...
sneak · 2h ago
Seems to me that if you want to waste time and money engineering your setup more net efficient, just buy a few solar panels and LiFePo4 batteries to buffer. You can run other stuff off of it, too.

I always choose “make more money” over “pinch pennies”.

hsbauauvhabzb · 59m ago
If that were the case you wouldn’t waste valuable time posting snide responses to hn posts.
nodesocket · 3h ago
While not Linux I have my Windows 11 rackmount gaming server sleep after 30 minutes but wake every morning at 8am for backups using WakeupOnStandBy which works great. I tried using built-in Windows task scheduler but it never worked correctly.