Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want systemd service to handle forking (my file doesn't handle forking by itself. So I'm relying on systemd for handling that)

My .service file:

Description=swamp services management service




Is specifying Type=forking enough for what I'm trying to achieve? Or is it similar to expect forking in upstart which actually tells upstart (if I understand correctly, not sure I do, I'm new at writing initscripts) that my service would handle forking/daemonizing.

share|improve this question

systemd has excellent documentation. See the page on service files:

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.

So, using that type will just tell systemd to wait until swamp returns and then consider it to be still running: making that happen remains your responsibility...

share|improve this answer
If the script doesn't do any forking, it's either oneshot (a typical short running script) or simple (a long-running service that that doesn't fork+exit). – Pavel Šimerda Apr 26 '14 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.