resume/suspend enery star linux from command line
A machine that is hibernating cannot come out of sleep without pressing the power button, or sending a magic packet if the ethernet adaptor has Wake On Lan (WOL) capability and the motherboard supports that. WOL packets can only be generated on the local network, not remotely from other networks.
-Adam
How can I automatically hibernate and reawaken my Ubuntu server?
This question has an answer here: https://askubuntu.com/questions/61708/automatically-sleep-and-wake-up-at-specific-times
Basically, the solution is to use rtcwake
with the --mode
option. Here is the description from man rtcwake
:
-m mode | --mode mode
Use standby state mode. Valid values are:
standby ACPI state S1. This state offers minimal, though real, power savings,
while providing a very low-latency transition back to a working
system. This is the default mode.
mem ACPI state S3 (Suspend-to-RAM). This state offers significant power
savings as everything in the system is put into a low-power state,
except for memory, which is placed in self-refresh mode to retain
its contents.
disk ACPI state S4 (Suspend-to-disk). This state offers the greatest power
savings, and can be used even in the absence of low-level platform
support for power management. This state operates similarly to
Suspend-to-RAM, but includes a final step of writing memory contents
to disk.
off ACPI state S5 (Poweroff). This is done by calling '/sbin/shutdown'.
Not officially supported by ACPI, but usually working.
How to know if system has just woken up from a mem sleep?
Linux device drivers for PCI devices can optionally handle suspend and resume which, presumably, the kernel calls, respectively, just before the system is suspended, and just after resuming from a suspend. The PCI entrypoints are in struct pci_driver
.
You could write and install a trivial device driver which does nothing more than sense resume operations and provides an indication to any interested processes. The simplest might be to support a file read() which returns a single byte whenever a resume is sensed. The program only need open the device and leave a thread stuck reading a single character. Whenever the read succeeds, the system just resumed.
More to the point, if the devices your application is handling have device drivers, the drivers should be updated to react appropriately to a resume.
Linux Power management API
DBus provides some basic power management functionality within the org.freedesktop.PowerManagement
bus.
Related Topics
Using Output of Previous Commands in Bash
What Is Eof!! in The Bash Script
Os X Permission Denied for /Usr/Local/Lib
Openssl/Rsa - Using a Public Key to Decrypt
On-The-Fly Output Redirection, Seeing The File Redirection Output While The Program Is Still Running
Check If All Lines from One File Are Present Somewhere in Another File
Securing Udp - Openssl or Gnutls or ...
Linux: How to Debug a Sigsegv? How to Trace The Error Source
Why Processes Are Deprived of CPU for Too Long While Busy Looping in Linux Kernel
Docker Run Hello-World Still Fails, Permission Denied
How to Pass Env Variables Between Make Targets
Principle of Qemu CPU Emulation
How to Disable Serial Console(Non-Kernel) in U-Boot
Ansible: Check If Service Is Listening on a Specific Port
How to Programmatically Invert Screen Colors in Linux
Implementing Basic File System
How to Find The Memory Consumption of a Particular Process in Linux for Every 5 Seconds