commit ea30deb53f7abd18dfba55be0468e49b42b07261
parent 405117d42e6222c20e066e67487e87da0d8cf271
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Tue, 8 Sep 2015 22:01:34 +0000
Add specific exit to s6-svstat when service is unsupervised
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/doc/s6-svstat.html b/doc/s6-svstat.html
@@ -61,5 +61,14 @@ print the signal number. By default, a symbolic name for the signal will be
printed instead. </li>
</ul>
+<h2> Exit codes </h2>
+
+<ul>
+ <li> 0: success </li>
+ <li> 1: s6-supervise not running on <em>servicedir</em> </li>
+ <li> 100: wrong usage </li>
+ <li> 111: system call failed </li>
+</ul>
+
</body>
</html>
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c
@@ -43,6 +43,9 @@ int main (int argc, char const *const *argv)
if (!s6_svstatus_read(*argv, &status))
strerr_diefu2sys(111, "read status for ", *argv) ;
+ isup = s6_svc_ok(argv[0]) ;
+ if (isup < 0) strerr_diefu2sys(111, "check ", argv[0]) ;
+ if (!isup) strerr_diefu3x(1, "read status for ", argv[0], ": s6-supervise not running") ;
tain_now_g() ;
if (tain_future(&status.stamp)) tain_copynow(&status.stamp) ;