docker-systemctl-replacement
docker-systemctl-replacement copied to clipboard
align exit-code with systemd standard
There is a section in the systemd documentation that list LSB exit codes that should be followed. I know that quite some of the result values do not quite match but it would be better to follow style when having not checked what the systemd systemctl command returns.
https://www.freedesktop.org/software/systemd/man/systemd.exec.html
- 0 EXIT_SUCCESS Generic success code.
- 1 EXIT_FAILURE Generic failure or unspecified error.
- 2 EXIT_INVALIDARGUMENT Invalid or excess arguments.
- 3 EXIT_NOTIMPLEMENTED Unimplemented feature.
- 4 EXIT_NOPERMISSION The user has insufficient privileges.
- 5 EXIT_NOTINSTALLED The program is not installed.
- 6 EXIT_NOTCONFIGURED The program is not configured.
- 7 EXIT_NOTRUNNING The program is not running.
plus exit codes 200... 214
On the documentation for the systemctl command a slightly different table is used
https://www.freedesktop.org/software/systemd/man/systemctl.html
- 0 "program is running or service is OK" .. unit is active
- 1 "program is dead and /var/run pid file exists" .. unit not failed (used by is-failed)
- 2 "program is dead and /var/lock lock file exists" ... unused
- 3 "program is not running" ... unit is not active
- 4 "program or service status is unknown" .. no such unit