Re: Running VDR from systemd on Raspberry Pi OS

Udo Richter <[email protected]> Sun, 25 Dec 2022 13:10:51 +0100
Newsgroups gmane.linux.vdr
Message-ID <[email protected]>
On 24.12.22 10:33, Marko Mäkelä wrote:
> then
>    sudo service vdr stop
>    sudo umount /video
>    sudo udisksctl power-off -b /dev/sda
> fi
>
> The first step appears to terminate the shell script, because the shell
> is a subprocess of VDR. So, the storage will remain mounted and powered
> on. I guess that we need to launch a separate "vdr-shutdown" service
> that would take care of the remaining steps. Has someone already
> implemented something like this?

Maybe you can prevent that by backgrounding and setting some bash trap's
on SIGINT or SIGKILL.

Other methods to decouple a process so it runs separated, would be
'nohup' or the old 'at now' trick.

However, I'd say the most clean way is to include the unmount and
udiskctrl into the vdr shutdown itself, so these commands run within the
vdr service after the vdr process stops. That way you just have to fire
the service stop and are done.

 From a quick look into documentation, you can just not wait for the
stop to complete:

systemctl stop vdr.service --no-block


Or if you want to go full systemd, you can probably do a service that
does the mount/unmount/poweroff on start/stop, and then add that as
requirement to the vdr service.


Cheers,

Udo


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