Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

systemd: remember to keep the daemons alive

My sinopia daemon refused to start. After dig out the journal, I found that ExecStop run straight after ExecStart, what the…

After some research, I found that for daemons, or any other program that put themselves at the background, systemd thought they are stopped, thus stop the service for you. To prevent this, you need following in your systemd service file:


so your daemons can live happily ever after.



4 responses to “systemd: remember to keep the daemons alive

  1. Alexander 2016/08/09 at 4:40 pm

    Type=forking or simple will do the same job. RemainAfterExit needs to be done only for one time scripts with Type=oneshot (f.e. ntpdate).


    • dingyichen 2016/08/09 at 6:24 pm

      Not sure “Type=forking” is the “proper” way in my case.
      I use “make run” to launch the actual daemon (e.g. docker run -d), so it is weird to use forking as it does not call fork().

      According to man pages, RemainAfterExit does not need to associate to type oneshot.
      In fact, unless you are desperately need multiple ExecStart, it does not really make sense to call it “oneshot” if it is intended to stay.


  2. Pingback: systemd: remember to keep the daemons alive https://dingyichen.word… | Dr. Roy Schestowitz (罗伊)

  3. Pingback: Quickies: civilize systemd | 0ddn1x: tricks with *nix

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: