Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show 'svc -o' state in svstat output #15

Closed
josb-ebaysf opened this issue Oct 15, 2013 · 1 comment
Closed

Show 'svc -o' state in svstat output #15

josb-ebaysf opened this issue Oct 15, 2013 · 1 comment

Comments

@josb-ebaysf
Copy link

The prototype patch below adds displaying ', once' to the svstat output if svc -o /service/foo' is used instead ofsvc -u /service/foo'. Example:

# svc -u /service/rubygems/
# ./svstat /service/rubygems/
/service/rubygems/: up (pid 801) 4791279 seconds, running
# svc -o /service/rubygems/
# ./svstat /service/rubygems/
/service/rubygems/: up (pid 801) 4791288 seconds, running, once
# svc -u /service/rubygems/
# ./svstat /service/rubygems/
/service/rubygems/: up (pid 801) 4791294 seconds, running
#

Patch:

# git status
diff --git a/svstat.c b/svstat.c
index 03db0b8..09d2173 100644
--- a/svstat.c
+++ b/svstat.c
@@ -89,6 +89,8 @@ static void showstatus(const char status[19], int r, int normallyup)
     if (x)
       buffer_puts(&b,x);
   }
+  if (pid && (want == '\000'))
+    buffer_puts(&b,", once");
 }

 void doit(const char *dir)

As it stands, the unittest gives an error but should be easy to fix by changing it to support the svc -o' case in addition to thesvc -u' case.

# make
env - /bin/sh rts.sh 2>&1 | cat -v > rts
diff -u rts.exp rts
--- rts.exp 2013-10-14 16:50:05.051427273 -0700
+++ rts 2013-10-14 16:51:49.236428375 -0700
@@ -187,12 +187,12 @@
 100
 0
 --- svstat and svup work for logged services
-.: up (pid x) x seconds, normally down, running
-. log: up (pid x) x seconds, normally down, running
+.: up (pid x) x seconds, normally down, running, once
+. log: up (pid x) x seconds, normally down, running, once
 0
-.: up (pid x) x seconds, normally down, running
+.: up (pid x) x seconds, normally down, running, once
 0
-. log: up (pid x) x seconds, normally down, running
+. log: up (pid x) x seconds, normally down, running, once
 0
 0
 0
make: *** [rts] Error 1
#

What do you think?

@timbunce
Copy link

timbunce commented Apr 7, 2014

+1

@bruceg bruceg closed this as completed in 5526cf4 Sep 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants