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

2013-08-09 Thread Lennart Poettering
On Wed, 07.08.13 10:12, Mathijs Kwik (math...@bluescreen303.nl) wrote: > Hi all, > > I have a few things that need to get run after waking up my laptop > (things like hdparm to set device power options/spindown time). > I created oneshot, remainafterexit services for those and made them > wanted

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

2013-08-08 Thread 孙冰
Hi, Yep. I have the exact same sleep@.service and it works. BTW, sleep.target is pulled in by both suspend.target and hibernate.target. There are some use cases that a hook should be only invoked by suspend.target (or hibernate.target). For instance, I have a hook used with the tuxoniceui: -

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

2013-08-08 Thread killermoehre
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/wic

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

2013-08-07 Thread Mathijs Kwik
孙冰 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.

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

2013-08-07 Thread 孙冰
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

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

2013-08-07 Thread Mathijs Kwik
Indeed, that sounds like a solution. It's a bit of a philosophical thing though, remainafterexit+oneshot works nicely for things that represent a certain state (powersaving on) which can be inspected and turned off. oneshot "scripts" don't feel natural to me somehow without such a state (which Re

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

2013-08-07 Thread Tom Gundersen
On Wed, Aug 7, 2013 at 10:12 AM, Mathijs Kwik wrote: > I have a few things that need to get run after waking up my laptop > (things like hdparm to set device power options/spindown time). > I created oneshot, remainafterexit services for those and made them > wanted by multi-user.target.This works

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

2013-08-07 Thread Mathijs Kwik
Hi all, I have a few things that need to get run after waking up my laptop (things like hdparm to set device power options/spindown time). I created oneshot, remainafterexit services for those and made them wanted by multi-user.target.This works fine for the first boot. As I consider these servic