2

I have bought a noisy, power hungry home server. Ideally, I would like for it to be off exactly when I do not use it and be on exactly when I do use it.

This ideal scenario is impossible, so I have come up with a less ideal scenario but also more possible.

Based on https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface I want the system to detect being idle (e.g. 15-min load <= 0.01), then it should suspend-to-both (hybrid suspend or S4 followed by S3). Let us assume I can get that to work.

This way it can quickly be woken by wake-on-lan and be used by me.

But if the system is not used for 24 hours, then I want the system to go from the S3+4 state to S5 (soft power off), so that next time the server is woken (by wake-on-lan), it can resume from the S4-state (suspend-to-disk).

Is there a way to do that?

Maybe there is a timer in the ACPI-controller that I can activate, so that it powers off 24 hours after being suspended (unless it is currently running).

Or maybe I can tell the BIOS to turn off the computer 24 hours from now and update that every hour?

Or a watchdog that will power off the server if not touched within 24 hours?

Or is there another way to force the computer to soft power off when it is already in suspend-to-ram state?

Edit

A workaround may be to have another machine (e.g. access point) use the iDRAC in the server to turn the server off. Not as ideal, but might work in my specific situation. The server should then at boot and every hour tell the access point to power off the server in 24 hours.

1 Answer 1

0

To perform the suspend-to-disk you will have to wake up fully, to power on the disk to write the hibernation data to it.

Possible solution:

  • Set the BIOS to wake up every day at a given time
  • Add a script /etc/pm/sleep.d that will be called with thaw or resume.
  • This script checks a marker file (touch /run/wakeuptime) and:
    • the marker file exists and is 24 hours old(*):start hibernation
    • else create the marker (touch /run/wakeuptime) and suspend

Ideally, you can tell the BIOS to only wakeup if the system is in S3, and keep it sleeping if in S4.

(*) for this I would use [[ -n $(find /run -maxdepth 1 -path /run/wakeuptime -mmin -1440) ]].

1
  • I am going to use s2both: That will write the image to disk but instead of powering off it will suspend to RAM. It is meant for laptops: Suspend to ram, but if it runs out of battery, the laptop can resume from disk. So the task is not to make the server suspend to disk - that has already been taken care of.
    – Ole Tange
    Oct 25, 2019 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.