summary refs log tree commit diff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2002-10-06 10:28:16 +0000
committerGerrit Pape <pape@smarden.org>2002-10-06 10:28:16 +0000
commit0920ba6338ed9cb0fc1548debd9f52bcfd81789d (patch)
treede3622435eb680a70b188ad98d7d44412cab7070
parentfdb8032441080bc02fa428fddf9766cfc49883e3 (diff)
downloadrunit-0920ba6338ed9cb0fc1548debd9f52bcfd81789d.tar.gz
runit-0920ba6338ed9cb0fc1548debd9f52bcfd81789d.tar.xz
runit-0920ba6338ed9cb0fc1548debd9f52bcfd81789d.zip
minor.
-rw-r--r--debian/changelog2
-rw-r--r--package/CHANGES3
-rw-r--r--src/svwaitdown.c46
3 files changed, 25 insertions, 26 deletions
diff --git a/debian/changelog b/debian/changelog
index 32fb7a4..f6a7bfe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,7 @@ runit (0.6.4-1) sarge; urgency=low
   * preinst: new; create hardlink /sbin/runit.old -> /sbin/runit on
     upgrade.
 
- -- Gerrit Pape <pape@smarden.org>  Sun,  6 Oct 2002 11:41:41 +0200
+ -- Gerrit Pape <pape@smarden.org>  Sun,  6 Oct 2002 12:24:15 +0200
 
 runit (0.6.0-1) sarge; urgency=low
 
diff --git a/package/CHANGES b/package/CHANGES
index b44beb4..3a23b50 100644
--- a/package/CHANGES
+++ b/package/CHANGES
@@ -1,5 +1,5 @@
 runit 0.6.4
-Sun, 06 Oct 2002 11:41:29 +0200
+Sun, 06 Oct 2002 12:23:56 +0200
   * runsvdir.c: check service directory's inode and device in addition
     to mtime; sleep at least 1 second before restarting run svprocesses.
   * runsv.c: use status[19] for state information; control pipe supports e.
@@ -8,6 +8,7 @@ Sun, 06 Oct 2002 11:41:29 +0200
   * runsvchdir: new; change directory runsvdir is running in (switch
     runlevels).
   * man/runsvchdir.8, doc/runsvchdir.8.html: new.
+  * svwaitdown.c: -k option: only kill service that still are up on timeout.
 
 runit 0.6.0
 Fri, 27 Sep 2002 16:34:57 +0200
diff --git a/src/svwaitdown.c b/src/svwaitdown.c
index 5e09304..504a810 100644
--- a/src/svwaitdown.c
+++ b/src/svwaitdown.c
@@ -12,6 +12,8 @@
 #define INFO "svwaitdown: "
 #define USAGE " [ -v ] [ -t 2..6000 ] service ..."
 
+#define VERSION "$Id$"
+
 const char *progname;
 const char * const *dir;
 unsigned int rc =0;
@@ -59,7 +61,7 @@ int main (int argc, const char * const *argv) {
       verbose =1;
       break;
     case 'V':
-      strerr_warn1("$Id$", 0);
+      strerr_warn1(VERSION, 0);
     case '?':
       usage();
     }
@@ -125,35 +127,31 @@ int main (int argc, const char * const *argv) {
       /* timeout */
       if (verbose) strerr_warn2(INFO, "timeout.", 0);
       if (dokill) {
-	dir =argv;
-	while (*dir) {
-	  if (chdir(*dir) == -1) {
-	    warn(*dir, ": unable to change directory: ", &strerr_sys);
-	    continue;
-	  }
-	  if ((fd =open_write("supervise/control")) == -1) {
-	    if (errno == error_nodevice) {
-	      if (verbose)
-		strerr_warn3(INFO, *dir,
-			     ": supervise not running.", 0);
-	      dir++;
-	    }
-	    else
-	      warn(*argv, ": unable to open supervise/control: ", &strerr_sys);
-	    continue;
+	if (chdir(*dir) == -1) {
+	  warn(*dir, ": unable to change directory: ", &strerr_sys);
+	  continue;
+	}
+	if ((fd =open_write("supervise/control")) == -1) {
+	  if (errno == error_nodevice) {
+	    if (verbose)
+	      strerr_warn3(INFO, *dir, ": supervise not running.", 0);
+	    dir++;
 	  }
-	  if (write(fd, "k", 1) != 1)
-	    warn(*argv,
-		 ": unable to write to supervise/control: ", &strerr_sys);
 	  else
-	    strerr_warn3(INFO, *dir, ": killed.", 0);
-	  close(fd);
-	  dir++;
+	    warn(*argv, ": unable to open supervise/control: ", &strerr_sys);
+	  continue;
 	}
+	if (write(fd, "k", 1) != 1)
+	  warn(*argv, ": unable to write to supervise/control: ", &strerr_sys);
+	else
+	  strerr_warn3(INFO, *dir, ": killed.", 0);
+	close(fd);
+	dir++;
+	if (! *dir) exit(111);
+	continue;
       }
       exit(111);
     }
-
     sleep(1);
   }
   if (rc > 100) rc =100;