孙冰 <subi.the.dream.wal...@gmail.com> writes:

> I use this:
> ----------------------------------------
> [Unit]
> Description=Wicd sleep hook
> Before=sleep.target
> StopWhenUnneeded=yes
>
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=-/usr/share/wicd/daemon/suspend.py
> ExecStop=-/usr/share/wicd/daemon/autoconnect.py
>
> [Install]
> WantedBy=sleep.target
> -----------------------------------------

Clever :)

It turns out I always misinterpreted the documentation for
StopWhenUnneeded. I never read past the first sentence and assumed this
option was only going to stop services "when it felt like it".

But this is a very nice solution, still stateful (remainafterexit) but
by focusing on the sleep-state instead of the before-sleep and
after-sleep it nicely works around cyclic/conflicting dependencies.

Thanks!

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to