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".
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 ?
Kind regards,
Tomas
- [systemd-devel] Launching script that needs network bef... Tomáš Hnyk
-