Today, I tested rtcwake on several x86 or x86-64 based computers.
The outcome:
(1) Suspend to RAM (say, "rtcwake -m mem -s 10"):
* Success: Every system.
(2) Wake-on-timer ("rtcwake -m no -s 120 && shutdown -h now" or "rtcwake
-m off -s 120"):
* Success: Lenovo Thinkpad X220 (2012?), and a 5-year-old desktop system
* Fail: IBM Thinkpad X60 (Core Duo from 2006), a HP Zbook from 2016.
(3) Suspend to disk ("rtcwake -m disk -s 120") had no chance of working,
because I never configure …
[View More]any swap partition. I would assume that this
could only work if (2) worked in the first place. On the Debian systems
that I tried, the command would fail as expected. On one Arch Linux
system (Lenovo Thinkpad X220), it forcibly power off the computer and
fail to start automatically; a file system check ran on the manual
power-on.
GNU/Linux is the only operating system on each computer, and apart from
the 32-bit Thinkpad X60, everything boots up via UEFI.
In the BIOS setup of both the Thinkpad X60 and the HP laptop there are
some settings related to powering up on timer. Maybe with something like
nvram-wakeup (which was the only working option for a 2001 Intel Celeron
machine) they could be made to work.
Moral of the story: You can't expect wake-on-timer to "just work" even
on relatively recent hardware. Possibly the chances are better with
desktop or small-form-factor systems than with laptops.
Marko
[View Less]
Some time ago, I created the wiki page
https://www.linuxtv.org/vdrwiki/index.php/Systemd that describes much of
my VDR installation.
On my Raspberry Pi, there is no real-time-clock. My low-tech solution
for waking up VDR for recordings is that I set an alarm on my phone, to
remind me to turn on VDR when needed. Today, I refined that a little by
implementing an idle timeout shutdown when no further recording timers
exist, or when they are in the distant enough future.
I learned that …
[View More]there is a portable Linux tool "rtcwake" that should
support whatever is needed by VDR. It is much simpler than the
"nvram-wakeup" that I used almost 20 years ago. On my Raspberry Pi,
basically any "rtcwake" commands will fail. That provided a good way of
testing the fallback mechanisms of my shutdown script.
I think that it could be useful to include some Systemd integration
scripts in the VDR distribution. My systemd integration consists of 4
parts that are documented in the
https://www.linuxtv.org/vdrwiki/index.php/Systemd wiki page:
* /etc/systemd/system/vdr-keep-alive.sh to control system shutdown
* /var/lib/vdr/vdr-shutdown.sh to handle VDR shutdown (vdr -s)
* some configuration to have a VDR service in Systemd
* optional: additional configuration to have the video directory on USB
storage, to have VDR auto-start when the storage is plugged in.
Because rtcwake does not work on my VDR system, it would be nice to get
some feedback from users of wake-on-timer capable systems. It is
possible that the "rtcwake -m disk -s $2" and "rtcwake -m mem -s $2"
require that "vdr-keep-alive.sh stop" be invoked first and
"vdr-keep-alive.sh start" be invoked once rtcwake successfully returns
(at the wake-up time). It is also possible that the VDR process would
need to be restarted.
Best regards,
Marko
[View Less]