Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemainAfterExit is needed #21

Closed
gdraheim opened this issue Nov 30, 2017 · 2 comments
Closed

RemainAfterExit is needed #21

gdraheim opened this issue Nov 30, 2017 · 2 comments

Comments

@gdraheim
Copy link
Owner

The RemainAfterExit=yes option needs to be implemented. Without it a service may seem to be dead which is really running.

It was obverved specifically for Teamforge where the *.service file does not user type=forking where it should have:

[Service]
Type=simple
RemainAfterExit=yes

User=root
Group=root

ExecStart=/etc/init.d/collabnet start all
ExecStop=/etc/init.d/collabnet stop all
@gdraheim
Copy link
Owner Author

gdraheim commented Nov 30, 2017

From the systemd documentation:
https://www.freedesktop.org/software/systemd/man/systemd.service.html

RemainAfterExit=

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

Type=

  • Behavior of oneshot is similar to simple; however, it is expected that the process has to exit before systemd starts follow-up units. RemainAfterExit= is particularly useful for this type of service. This is the implied default if neither Type= nor ExecStart= are specified.

Example 3

  • For this, systemd knows the setting RemainAfterExit=yes, which causes systemd to consider the unit to be active if the start action exited successfully. This directive can be used with all types, but is most useful with Type=oneshot and Type=simple. With Type=oneshot, systemd waits until the start action has completed before it considers the unit to be active, so dependencies start only after the start action has succeeded. With Type=simple, dependencies will start immediately after the start action has been dispatched.

Example 4

  • Many traditional daemons/services background (i.e. fork, daemonize) themselves when starting. Set Type=forking in the service's unit file to support this mode of operation. systemd will consider the service to be in the process of initialization while the original program is still running. Once it exits successfully and at least a process remains (and RemainAfterExit=no), the service is considered started.

@gdraheim
Copy link
Owner Author

The patches have solved the real case where it was used.

A testcase was written to confirm the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant