When should the option RemainAfterExit needs to be set true when creating new systemd services?

后端 未结 3 1088
萌比男神i
萌比男神i 2021-01-03 20:19

I am trying to write a few services. Some of them have \'type\' option set to oneshot. But i am still confused when the option \'RemainAfterExit\' needs to be set true. (not

3条回答
  •  Happy的楠姐
    2021-01-03 21:03

    From Systemd page below is the description of RemainAfterExit

    RemainAfterExit= Takes a boolean value that specifies whether the service shall be considered active even when all its processes exited. Defaults to no.

    This simply means that if all your processes started from service exits, when you query the status of the service, its still says active if this flag is set to true. If set to false, then service status is inactive.

    This is particularly useful when you are adding dependency on services during bootup. wherein the service status is important to start dependent services.

提交回复
热议问题