[systemd-devel] Restart instantiated services after suspend

Lennart Poettering lennart at poettering.net
Wed Nov 20 13:51:10 PST 2013


On Tue, 19.11.13 14:18, Marcos Felipe Rasia de Mello (marcosfrm at gmail.com) wrote:

> Hi folks,
> 
> I am trying to disable HDDs power management in a systemd way (aka no
> shell scripts :)
> 
> /etc/udev/rules.d/99-hdparm.rules
> 
> SUBSYSTEM=="block", KERNEL=="sd*", ATTR{removable}=="0",
> TAG+="systemd", ENV{SYSTEMD_WANTS}+="hdparm@%k.service"

Why do you do this asyncrhonously via a systemd service? Given that this
tool runs and terminates quickly invokign this with RUN inside of the
udev rule itself sounds like the best approach.

> It works fine, but after the machine wakes up from suspend, I need
> that all hdparm at .service be run again. Is there a way to accomplish
> this?

Well, you could drop in a service into sleep.target.wants/ which orders
itself after systemd-suspend.service...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list