You are not logged in.

#1 2015-07-08 19:40:08

mkind
Member
Registered: 2012-08-11
Posts: 27

[Solved] Systemd stopping service on suspend

Hi,

consider the following examplified systemd service

[Unit]
Description=splone file system

[Service]
RemainAfterExit=yes
ExecStart=/usr/bin/echo starting service
ExecStop=/usr/bin/echo stopping stopping service
Conflicts=sleep.target shutdown.target 

Starting and stopping it via

 # systemctl {start|stop} myservice.service 

works fine. However, I want the service to be stopped on sleep in order to execute the ExecStop= command. I thought, I can achive this with the Conflicts= parameter.

What I can do, is having a seperate service which calls the ExecStop= command in its ExecStart= parameter which runs before the sleep.target. But I really would like a solution with only one file. Does anyone have an idea?

Last edited by mkind (2015-07-08 19:56:27)

Offline

#2 2015-07-08 19:49:33

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Systemd stopping service on suspend

Conflicts does not belong in [Service].

Offline

#3 2015-07-08 19:56:14

mkind
Member
Registered: 2012-08-11
Posts: 27

Re: [Solved] Systemd stopping service on suspend

Boah, big thanks. I have no idea, why I missed that!

Offline

Board footer

Powered by FluxBB