[systemd-devel] Starting a unit on resume from suspend/hibernate

Dimitrios Apostolou jimis at gmx.net
Thu Apr 2 10:34:55 PDT 2015


On Thu, 2 Apr 2015, Dimitrios Apostolou wrote:

> On Thu, 2 Apr 2015, Andrei Borzenkov wrote:
>
>>  В Thu, 2 Apr 2015 18:43:40 +0200 (CEST)
>>  Dimitrios Apostolou <jimis at gmx.net> пишет:
>> 
>> >  Conflicts=sleep.target
>> >  WantedBy=multi-user.target sleep.target
>>
>>  These are mutually conflicting. One one hand Conflicts says to stop your
>>  unit when sleep.target gets started, on the other hand WantedBy says to
>>  start your unit when sleep.target gets started. Only one can win.
>
> Indeed, but I was assuming that combined with "after" they could co-exist, 
> starting the unit after the dependency has started and stopped. And if it was 
> a problem I would expect a message, since it's easy to detect.
>
> Anyway even removing the Conflicts line does not help. "systemctl enable" 
> still does not install the symlink, and manually installing the symlink does 
> not change anything.

Hmmm I did some more trials with the "conflicts" line commented out. While 
just listing "sleep.target" didn't work, the following was successful and 
the unit starts after resuming:

After=sleep.target suspend.target hibernate.target hybrid-sleep.target
WantedBy=multi-user.target sleep.target suspend.target hibernate.target hybrid-sleep.target

In addition "systemctl disable/enable" didn't create the symlinks, I had 
to properly add them. Maybe it's a bug?


Thanks,
Dimitris


More information about the systemd-devel mailing list