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

David Strauss david at davidstrauss.net
Fri Nov 30 15:53:48 PST 2012


On Fri, Nov 30, 2012 at 2:28 PM, Khem Raj <raj.khem at gmail.com> wrote:
> 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

It's intentionally not supported, but it has been proposed in some
recent patches. I think it was proposed as OnStop= or OnShutdown=.

Reindl's suggestion will probably do what you want, but systemd won't
consider the stopping of the first service and the starting of the
second a transaction.

--
David Strauss
   | david at davidstrauss.net


More information about the systemd-devel mailing list