On Do, 16.08.18 12:18, Dave Reisner (d@xxxxxxxxxxxxxx) 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 > > In general, I'd suggest not depending on the specific values, but > instead using a more appropriate verb. For example, if you want to > know that a service is running, is 'systemctl is-active'. This is correct. This is supposed to match LSB status exit codes, but the mapping is a bit skewed due to different semantics. In general we return 0 on success, non-zero otherwise, but "systemctl status" (and a few verbs like it) do this differently to match LSB. We should probably document that better. I filed a bug requesting this now, so that we keep track of this. https://github.com/systemd/systemd/issues/10056 Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel