ACPI
Advanced Configuration and Power Interface (ACPI) allows dynamic control of power to various computer components for use (as an example) in reducing power use when the computer is idle, or allow the computer to be automatically started just before the business day begins, or to turn on the computer and run maintenance tasks at night. There used to be a common Basic Input Output System (BIOS) setting where one could specify the day(s) of the week and time at which power should be turned on so the computer would boot, however this functionality has generally disappeared in main boards manufactured after the year 2000 and the “RTC Alarm” must be set programatically using an Operating System (OS). The Wiki reports:
In computing, the Advanced Configuration and Power Interface (ACPI) specification provides an open standard that the operating systems can use for computer hardware discovery, configuration, power management, and monitoring. Internally, ACPI exports the available functionalities by providing certain instruction lists as part of the system firmware, which the operating system kernel interprets and executes to perform desired operations, using a form of embedded virtual machine.
First released in December 1996, ACPI defines platform-independent interfaces for hardware discovery, configuration, power management and monitoring, and is designed to replace Advanced Power Management(APM), , the MultiProcessor Specification and the Plug and Play BIOS (PnP) Specification.[1] ACPI brings the power management under the control of the operating system, as opposed to the previous BIOS-central system that relied on platform-specific firmware to determine power management and configuration policies.[2]
The ACPI specification defines the following four Global “Gx” states and six Sleep “Sx” states for an ACPI-compliant computer-system:[24][25]
- G0 (S0), Working: “Awaymode” is a subset of S0, where monitor is off but background tasks are running.
- G1, Sleeping: Divided into four states, S1 through S4:
- S1, Power on Suspend (POS): All the processor caches are flushed, and the CPU(s) stops executing instructions. The power to the CPU(s) and RAM is maintained. Devices that do not indicate they must remain on, may be powered off.
- S2: CPU powered off. Dirty cache is flushed to RAM.
- S3, commonly referred to as Standby, Sleep, or Suspend to RAM (STR): RAM remains powered.
- S4, Hibernation or Suspend to Disk: All content of the main memory is saved to non-volatile memory such as a hard drive, and is powered down.
- G2 (S5), Soft Off: G2/S5 is almost the same as G3 Mechanical Off, except that the power supply unit (PSU) still supplies power, at a minimum, to the power button to allow return to S0. A full reboot is required. No previous content is retained. Other components may remain powered so the computer can “wake” on input from the keyboard, clock, modem, LAN, or USB device.
- G3, Mechanical Off: The computer’s power has been totally removed via a mechanical switch (as on the rear of a PSU). The power cord can be removed and the system is safe for disassembly (typically, only thereal-time clock continues to run – using its own small battery).
Furthermore, the specification defines a Legacy state: the state on an operating system which does not support ACPI. In this state, the hardware and power are not managed via ACPI, effectively disabling ACPI.
https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface
Reading ACPI
Note that I shelled to root for all of the following. I guess you could type sudo and a password for every line. I am not that patient.
Borrowing from https://www.mythtv.org/wiki/ACPI_Wakeup, if you have an Ubuntu-esque system you can read the data related to your RTC settings with:
cat /proc/driver/rtc
This will spit out a list of parameters like:
#cat /proc/driver/rtc rtc_time : 11:56:42 rtc_date : 2015-10-27 alrm_time : 14:30:00 alrm_date : 2015-10-27 alarm_IRQ : no alrm_pending : no update IRQ enabled : no periodic IRQ enabled : no periodic IRQ frequency : 1024 max user IRQ frequency : 64 24hr : yes periodic_IRQ : no update_IRQ : no HPET_emulated : yes BCD : yes DST_enable : no periodic_freq : 1024 batt_status : okay
If cat /proc/driver/rtc gave you a list, then you can then try setting the alarm a short time into the future and powering down the machine, then wait to see if it powers on.
#SECS=`date -u --date "2015-10-27 12:11:00" +%s` #echo 0 > /sys/class/rtc/rtc0/wakealarm #echo $SECS > /sys/class/rtc/rtc0/wakealarm #cat /proc/driver/rtc rtc_time : 12:06:10 rtc_date : 2015-10-27 alrm_time : 12:11:00 <<<--------------LOOK HERE alrm_date : 2015-10-27 <<<--------------LOOK HERE alarm_IRQ : yes <<<--------------LOOK HERE alrm_pending : no update IRQ enabled : no periodic IRQ enabled : no periodic IRQ frequency : 1024 max user IRQ frequency : 64 24hr : yes periodic_IRQ : no update_IRQ : no HPET_emulated : yes BCD : yes DST_enable : no periodic_freq : 1024 batt_status : okay #halt -p
The MythTV blog also says that Linux writes the current time to the hardware clock (RTC) which sometimes shuts off the alarm functionality, so modify the /etc/init/hwclock-save.conf file by adding a line “echo “$ACPITIME” > /sys/class/rtc/rtc0/wakealarm” at the end as this:
# hwclock-save - save system clock to hardware clock # # This task saves the time from the system clock back to the hardware # clock on shutdown. description "save system clock to hardware clock" start on runlevel [06] task script . /etc/default/rcS [ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime" [ "$BADYEAR" = "yes" ] && badyear="--badyear" ACPITIME=`cat /sys/class/rtc/rtc0/wakealarm` exec hwclock --rtc=/dev/rtc0 --systohc $tz --noadjfile $badyear echo "$ACPITIME" > /sys/class/rtc/rtc0/wakealarm end script
I have three workstations in my lab that cannot be started at night for their maintenance by setting Wake on RTC Alarm in the BIOS settings, so I will install this on those three PCs and report back as to whether it works and whether the alarm must be re-set each day so it fires off again the next night. It is also possible booting to Windows may break it.