I am searching for a way to prevent shutdown/standby when tvheadend (or vdr) is currently recording.
What I found so far:
-
Prevent shutdown when rsnapshot is running:
Which I don't like because it requires tvheadend to have root privileges and the link referenced seems to provide variants which do not work any more. -
TVHeadend Wakup:
Setting Wake up time works fine. But pm-suspend does not check if a KDE session is active but instantly suspends. -
How can I make shutdown not require admin password?:
works only for a very special case: checks if users are logged in
I see two solutions:
- Either TVHeadend script calls some KDE functions to ask for KDE state (screen locked, user logged in etc) and issues shutdown/suspend calls as seen in the above example.
- or modify the shutdown behavior of KDE so it checks if any TVH recording is currently active.
I cannot find any docs about these two variants.
Best Answer
Found a really easy solution!
Create a file
/etc/pm/sleep.d/70-check-recordings
.In this file check if a recording currently is active. If yes, just return
exit 1
. That's it. Suspend will be aborted.My script looks like this, it is based on this at tvheadend.
Now set up KDE to handle standby after time-out. If a recording is active, KDE standby is aborted by the above script.
See also this in the MythTV documentation.