Frequently Asked Question
What does Type= mean in a service unit (simple, exec, forking, oneshot, notify)?
Type= tells systemd how to decide that a service has finished starting up, important
because anything that depends on this service should wait until then. simple (the
historic default) says the main process is whatever ExecStart= runs, and the service
is considered started the moment fork() returns. exec is the modern, stricter
default: systemd waits until the binary has been successfully exec()'d before
regarding the service as up. forking matches classic Unix daemons that fork into the
background and let the parent exit; you usually also need PIDFile= so systemd can
track the surviving child.
oneshot is for short-lived units that run to completion, backups, mount preparation,
one-off setup steps, and is treated as "active" while the command is running and (with
RemainAfterExit=yes) afterwards. notify is the strongest contract: the service
itself calls sd_notify(READY=1) to tell systemd it has finished initialising,
typically once it is listening on its socket. Choosing the right type makes the
difference between dependent units starting too early and starting at exactly the right
moment.