1

The man page systemd.service(5) explains the Type options for services:

Type=

Configures the process start-up type for this service unit. One of simple, forking, oneshot, dbus, notify or idle.

If set to simple (the default if neither Type= nor BusName=, but ExecStart= are specified), it is expected that the process configured with ExecStart= is the main process of the service. In this mode, if the process offers functionality to other processes on the system, its communication channels should be installed before the daemon is started up (e.g. sockets set up by systemd, via socket activation), as systemd will immediately proceed starting follow-up units.

This implies to me that systemd won't start the units in parallel here. Also here:

If set to forking, it is expected that the process configured with ExecStart= will call fork() as part of its start-up. The parent process is expected to exit when start-up is complete and all communication channels are set up. The child continues to run as the main daemon process. This is the behavior of traditional UNIX daemons. If this setting is used, it is recommended to also use the PIDFile= option, so that systemd can identify the main process of the daemon. systemd will proceed with starting follow-up units as soon as the parent process exits.

In other words, according to this man page systemd executes the service units sequentially? So when systemd activates a daemon process, it waits for it before it activiates follow up units? Doesn't make sense at all.

How Type affects the startup procedure of other units?

  • 1
    When it is talking about "follow-up" units, it is talking about units directed to run sequentially as determined but the unit "Before" and "After" directives. – Raman Sailopal Sep 28 '17 at 11:32
  • If the type is forking, "systemd will proceed with starting follow-up units as soon as the parent process exits." "The child continues to run as the main daemon process." The child is doing the heavy lifting here, the parent process is expected "to exit when start-up is complete", i.e. pretty quickly. – Johan Myréen Sep 28 '17 at 12:13
  • @RamanSailopal This makes sense now. – direprobs Sep 28 '17 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.