[systemd-bugs] [Bug 77507] New: systemctl status exits with failure status for a service that completed successfully

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Apr 15 21:12:30 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=77507

          Priority: medium
            Bug ID: 77507
          Assignee: systemd-bugs at lists.freedesktop.org
           Summary: systemctl status exits with failure status for a
                    service that completed successfully
        QA Contact: systemd-bugs at lists.freedesktop.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: tim at gfxmonk.net
          Hardware: Other
            Status: NEW
           Version: unspecified
         Component: general
           Product: systemd

When a service has _successfully_ exited, `systemctl status <unit-name>`
returns a nonzero exit code (specifically, 3).

I don't see how a successfully exited unit should constitute a failure - I
think it should exit 0.

Steps to reproduce below:
(I'm using --user mode for testing, but the behaviour is the same in system
mode)

----

$ cat ~/.config/systemd/user/myapp-service.service
[Service]
ExecStart=/usr/bin/true

$ systemctl --user daemon-reload

$ systemctl --user start myapp-service.service

$ systemctl --user status myapp-service.service; echo "STATUS: $?"
myapp-service.service
   Loaded: loaded (/home/sandbox/.config/systemd/user/myapp-service.service;
enabled)
   Active: inactive (dead) since Wed 2014-04-16 13:57:34 EST; 8s ago
  Process: 8486 ExecStart=/usr/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 8486 (code=exited, status=0/SUCCESS)

Apr 16 13:57:34 meep systemd[7899]: Started myapp-service.service.
STATUS: 3


$ systemctl --version
systemd 208
+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ

----


I'm using `systemctl status <all-units-I've-installed>` as a high level check
in a deployment script to check that nothing is broken, and I display the
output (and fail the deployment) when the result is nonzero. So this behaviour
breaks my deployment script now that I have added a routine (timer) service
which happens to run quickly.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20140416/ff2b6c48/attachment.html>


More information about the systemd-bugs mailing list