<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - systemctl status exits with failure status for a service that completed successfully"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=77507">77507</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>systemctl status exits with failure status for a service that completed successfully
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tim@gfxmonk.net
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>