[systemd-devel] When does a systemctl start ... returns to prompt?

Wojtek Swiatek w at swtk.info
Wed Aug 29 07:36:40 UTC 2018


Hello everyone

systemctl start myserv.service sometimes immediately returns to the shell
prompt and sometimes stays until the program is done. Specifically, taking
the example of two programs

- prog_one which starts in the foreground and never ends, defined as
ExecStart=/path/to/prog_one

- prog_two and prog_three which are defined as
Type=oneshot
ExecStart=/path/to/prog_two
ExecStartPost=/path/to/prog_three

systemctl start prog_one.service immediately returns (and prog_one keeps
running)
systemctl start prog_two.service does not return, waits until prog_two and
then progr_three finish before returning

If I do not use a Type in the prog_one unit, the unit fails because
prog_three is started right after prog_one is initialized (and still
running)

Question 1: what are the rules for systemctl start ... to immediately come
back to the prompt or not
Question 2: how can I configure the prog_two/prog_three case, i.e. having
them starting one after the other (= start prog_three when prog_two is
done), and have the prompt return immediately

Cheers
Wojtek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180829/d0567bcd/attachment.html>


More information about the systemd-devel mailing list