[systemd-devel] Fwd: best way to handle service restarts after hibernate/suspend?

killermoehre killermoehre at gmx.net
Thu Aug 8 03:16:46 PDT 2013


Am 08.08.2013 08:12, schrieb 孙冰:
> 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
> -----------------------------------------

Thank you very much for this idea. I think it can be expressed in a more
generic way:

----------------------------------------
[Unit]
Description=%I sleep hook
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/systemctl stop %I
ExecStop=-/usr/bin/systemctl start %I

[Install]
WantedBy=sleep.target
-----------------------------------------

It would be invoked from sleep-hook at .service.
What do you think?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130808/50c75d68/attachment.pgp>


More information about the systemd-devel mailing list