Integartion with systemd and rtcwake

Marko Mäkelä <[email protected]> Mon, 10 Apr 2023 16:07:50 +0300
Newsgroups gmane.linux.vdr
Message-ID <ZDQKJnVii/jj50vY@jyty>
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 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

_______________________________________________
vdr mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr