[systemd-devel] Return codes of systemctl (status)
Filipe Brandenburger
filbranden at google.com
Thu Aug 16 16:51:54 UTC 2018
On Thu, Aug 16, 2018 at 9:19 AM Dave Reisner <d at falconindy.com> wrote:
> On Thu, Aug 16, 2018 at 01:27:12PM +0200, Cecil Westerhof wrote:
> > The man page of systemctl says:
> > On success, 0 is returned, a non-zero failure code otherwise.
> >
> > When I do a systemctl status on a service that is not running I get a 3.
> > What other values can be returned and where do I find those?
>
> I believe exit codes are meant to conform to LSB specs:
>
> http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html
Yes, that is correct.
See comments and enum here:
https://github.com/systemd/systemd/blob/v239/src/systemctl/systemctl.c#L80
> In general, I'd suggest not depending on the specific values, but
> instead using a more appropriate verb.
Agreed. In particular, man page for systemctl simply says "on success,
0 is returned, a non-zero failure code otherwise" for exit status. In
other words, the specific non-zero exit codes are undocumented, so
shouldn't be relied upon.
Cheers,
Filipe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4851 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180816/438359f1/attachment.bin>
More information about the systemd-devel
mailing list