[systemd-devel] how to start a service when another sevice stops

Lennart Poettering lennart at poettering.net
Wed Dec 19 14:27:23 PST 2012


On Fri, 30.11.12 23:40, Reindl Harald (h.reindl at thelounge.net) wrote:

> Am 30.11.2012 23:28, schrieb Khem Raj:
> > I have a scenario where, I have foo.service which runs on boot and later bar.service runs and it has to stop
> > foo.service which I achieved by declaring it as Conflicts= in the unit file but I would like to restart foo.service
> > when bar.service is stopped. I have run out of ideas on how to achieve that. I am looking for help
> 
> ExecStopPost=/bin/systemctl start whatever.service

Yeah, this is what I would suggest too. Or, possibly the reverse,
i.e. use ExecStartPre=/usr/bin/systemctl stop foobar.service in the
second service.


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list