title: What return code does systemctl status return for an error in systemctl status (not the underlying service)?
body: <p><a href="http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT" rel="nofollow noreferrer">http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT</a></p>
  <p>According to this systemctl status has a special list of return codes which return information about the service you're querying.</p>
  <blockquote>
  <p>If the status action is requested, the init script will return the following exit status codes.</p>
  <pre><code>0 program is running or service is OK
  1 program is dead and /var/run pid file exists
  2 program is dead and /var/lock lock file exists
  3 program is not running
  4 program or service status is unknown
  5-99  reserved for future LSB use
  100-149   reserved for distribution use
  150-199   reserved for application use
  200-254   reserved
  </code></pre>
  </blockquote>
  <p>That's fine, but I'm dumbfounded on the fact that 1 does not mean that <code>systemctl status</code> itself failed (NOT THE UNDERLYING SERVICE).</p>
  <p>I'm writing a script that's querying the status of a service that is in the process of starting so I expect to see status code 3 a couple of times, and then 0. But what status code(s) should I be expecting when &quot;the <code>systemctl status</code> command is brazoke&quot;?</p>
  <p>I'm tempted to just say anything 5+ is an unrecoverable error and I should bail on waiting for the service to come up, but that's not specifically what this document says. It just gives generic reservations.</p>
  <p>If it's any help I'm using Ubuntu 16.04 and 18.04. Maybe that vendor has specific codes? I have no idea.</p>