summary refs log tree commit diff
path: root/src/sv.c
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2006-11-02 22:59:14 +0000
committerGerrit Pape <pape@smarden.org>2006-11-02 22:59:14 +0000
commita1bbb6ddcf9119220c509c2e6424cf6a5a20d984 (patch)
treee1691179493adeaa9e59410895afc47b50f2f704 /src/sv.c
parentc09a0fe2d6721235b106745b03e2992f0d35fc24 (diff)
downloadrunit-a1bbb6ddcf9119220c509c2e6424cf6a5a20d984.tar.gz
runit-a1bbb6ddcf9119220c509c2e6424cf6a5a20d984.tar.xz
runit-a1bbb6ddcf9119220c509c2e6424cf6a5a20d984.zip
* chpst.c, uidgid.c, uidgid.h: support numerical uid gid through
    chpst -[u|U] :uid:gid...
  * man/chpst.8: adapt; clarify that users and groups are looked up in
    /etc/passwd and /etc/group only.
  * sv.c: properly wait for a service to be restarted on 'restart';
    support checks through -v for pause, cont, kill.
Diffstat (limited to 'src/sv.c')
-rw-r--r--src/sv.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sv.c b/src/sv.c
index a9592f4..c8126a3 100644
--- a/src/sv.c
+++ b/src/sv.c
@@ -208,6 +208,7 @@ int check(char *a) {
   unsigned int pid;
 
   if ((r =svstatus_get()) == -1) return(-1);
+  while (*a) {
   if (r == 0) { if (*a == 'x') return(1); return(-1); }
   pid =(unsigned char)svstatus[15];
   pid <<=8; pid +=(unsigned char)svstatus[14];
@@ -220,8 +221,9 @@ int check(char *a) {
     if (!checkscript()) return(0);
     break;
   case 'd': if (pid) return(0); break;
-  case 'c': if (pid) if (!checkscript()) return(0); break;
+    case 'C': if (pid) if (!checkscript()) return(0); break;
   case 't':
+    case 'k':
     if (!pid && svstatus[17] == 'd') break;
     tai_unpack(svstatus, &tstatus);
     if ((tstart.sec.x > tstatus.x) || !pid || svstatus[18] || !checkscript())
@@ -231,6 +233,11 @@ int check(char *a) {
     tai_unpack(svstatus, &tstatus);
     if ((!pid && tstart.sec.x > tstatus.x) || (pid && svstatus[17] != 'd'))
       return(0);
+      break;
+    case 'p': if (pid && !svstatus[16]) return(0); break;
+    case 'c': if (pid && svstatus[16]) return(0); break;
+    }
+    ++a;
   }
   outs(OK); svstatus_print(*service); flush("\n");
   return(1);
@@ -297,7 +304,7 @@ int main(int argc, char **argv) {
   case 'T':
     acts ="tc"; kll =1; cbk =&check; break;
   case 'c':
-    if (!str_diff(action, "check")) { act =0; acts ="c"; cbk =&check; break; }
+    if (!str_diff(action, "check")) { act =0; acts ="C"; cbk =&check; break; }
   case 'u': case 'd': case 'o': case 't': case 'p': case 'h':
   case 'a': case 'i': case 'k': case 'q': case '1': case '2':
     action[1] =0; acts =action; break;