On Mon, Jan 24, 2022 at 1:14 AM Tomáš Hnyk <tomash...@gmail.com> wrote: > > Hello, > I have my computer hooked up to an AVR that runs my home cinema and ideally I > would like the computer to turn off the AVR when I turn it off or suspend it. > The only way to do this is over network and I wrote a simple script that does > just that. Hooking it to shutdown was quite easy using network.target that is > defined when shutting down. > > I am struggling to make it work with suspend though. When I look at the logs, > terminating network seems to be the first thing that happens when suspend is > invoked. I tried putting the script to /usr/lib/systemd/system-sleep/ and it > runs, but only after network si down, so it fails. Running the script with > systemd-inhibit (ExecStart=/usr/bin/systemd-inhibit --what=sleep my_script) > tells me that "Failed to inhibit: The operation inhibition has been requested > for is already running". >
What network management program are you using? > Is there a way to make this work with service files by specifying that the > script needs to be run before network is shut down or would I need to run a > daemon listening for PrepareForSleep as here: > https://github.com/davidn/av/blob/master/av ? > Yes, this is probably the only generic solution.