commit 8b0b2c4737a7a81904d58361519ddf0a89f4158e
parent 6a6d3f9a4c2538c79be221124e985382602d77a6
Author: Gerrit Pape <pape@smarden.org>
Date: Sun, 23 Dec 2001 17:14:08 +0000
manpage svwait* added.
cleanup.
Diffstat:
11 files changed, 187 insertions(+), 117 deletions(-)
diff --git a/Makefile b/Makefile
@@ -2,7 +2,7 @@ DESTDIR=
PACKAGE=runit-0.2.2
DIRS=doc man etc package src
-MANPAGES=man/runit.8 man/runit-init.8
+MANPAGES=man/runit.8 man/runit-init.8 man/svwaitdown.8 man/svwaitup.8
DAEMONTOOLS_PD=daemontools-pd-0.76
all: clean .manpages $(DAEMONTOOLS_PD).tar.gz $(PACKAGE).tar.gz
diff --git a/doc/runscripts.html b/doc/runscripts.html
@@ -27,8 +27,8 @@ an operating system not stated here, please
<h3><a name="getty">A <tt>mingetty</tt> run script</a></h3>
<i>(Debian)</i>
<pre>
-#!/bin/sh
-exec mingetty tty5
+ #!/bin/sh
+ exec mingetty tty5
</pre>
The <a href="index.html">runit</a> package does not care about utmp records
for getties. You should choose a getty that handles its own utmp and wtmp
@@ -37,9 +37,9 @@ records. Debian's <tt>mingetty</tt> does create his own utmp record.
<h3><a name="sshd">A <tt>sshd</tt> run script</a></h3>
<i>(Debian woody)</i>
<pre>
-#!/bin/sh
-exec 2>&1
-exec sshd -D -e
+ #!/bin/sh
+ exec 2>&1
+ exec sshd -D -e
</pre>
This service needs a
<a href="http://cr.yp.to/daemontools/faq/create.html#runlog">log service</a>
@@ -50,17 +50,16 @@ The <tt>sshd</tt> program is version <tt>OpenSSH_2.9p2</tt>.
<h3><a name="klogd">A <tt>klogd</tt> run script</a></h3>
<i>(Debian woody)</i>
<pre>
-#!/bin/sh
-exec 2>&1
-exec /sbin/klogd -n
+ #!/bin/sh
+ exec /sbin/klogd -n
</pre>
<hr>
<h3><a name="dhcpd">A <tt>dhcpd</tt> run script</a></h3>
<i>(Debian woody)</i>
<pre>
-#!/bin/sh
-exec 2>&1
-exec dhcpd-2.2.x -d -f
+ #!/bin/sh
+ exec 2>&1
+ exec dhcpd-2.2.x -d -f
</pre>
This service needs a
<a href="http://cr.yp.to/daemontools/faq/create.html#runlog">log service</a>
@@ -69,15 +68,15 @@ to be set up.
<h3><a name="dhclient">A <tt>dhclient</tt> run script</a></h3>
<i>(Debian woody)</i>
<pre>
-#!/bin/sh
-exec dhclient -d eth0
+ #!/bin/sh
+ exec dhclient -d eth0
</pre>
<hr>
<h3><a name="gdm">A <tt>gdm</tt> run script</a></h4>
<i>(Debian woody)</i>
<pre>
-#!/bin/sh
-exec gdm -nodaemon
+ #!/bin/sh
+ exec gdm -nodaemon
</pre>
<hr>
<address><a href="mailto:pape@smarden.org">
diff --git a/doc/usedietlibc.html b/doc/usedietlibc.html
@@ -12,17 +12,9 @@
Check that you have the recent version of
<a href="http://www.fefe.de/dietlibc/">dietlibc</a> installed.
<p>
-Change to the source directory of <i>runit</i> and modify the Makefile to
-use <tt>diet</tt>:
+Change to the source directory of <i>runit</i>:
<pre>
# cd /package/admin/runit/src
- # vi Makefile
-</pre>
-Modify the <tt>CC</tt> and <tt>LDFLAGS</tt> variables in the
-<tt>Makefile</tt> to these settings:
-<pre>
- CC=diet gcc
- LDFLAGS=-Wall -O3 -s -Os -pipe
</pre>
Download
<a href="http://smarden.org/pape/djb/manpages/daemontools-pd-0.76.tar.gz">
diff --git a/man/runit-init.8 b/man/runit-init.8
@@ -1,6 +1,6 @@
.TH runit-init 8
.SH NAME
-init \- the UNIX process no 1
+init \- a UNIX process no 1
.SH SYNOPSIS
.B init
[ 0 | 6 ]
@@ -41,8 +41,10 @@ files are touched. Then a CONT signal is sent to
.B runit-init
returns 111 on error, 0 in all other cases.
.SH SEE ALSO
-runit(8)
-
+runit(8),
+svwaitdown(8),
+svwaitup(8)
+.P
http://smarden.org/runit/
.SH AUTHOR
Gerrit Pape <pape@smarden.org>
diff --git a/man/runit.8 b/man/runit.8
@@ -61,8 +61,10 @@ if
.B runit
receives an INT signal, a ctrl-alt-del keyboard request is triggered.
.SH SEE ALSO
-runit-init(8)
-
+runit-init(8),
+svwaitdown(8),
+svwaitup(8)
+.P
http://smarden.org/runit/
.SH AUTHOR
Gerrit Pape <pape@smarden.org>
diff --git a/man/svwaitdown.8 b/man/svwaitdown.8
@@ -0,0 +1,84 @@
+.TH svwaitdown 8
+.SH NAME
+svwaitdown \- waits for services controlled by supervise(8) to be down
+.SH SYNOPSIS
+.B svwaitdown
+[
+.B \-v
+]
+[
+.B \-t
+.I sec
+]
+.I services
+.SH DESCRIPTION
+.I services
+consist of one or more arguments.
+.P
+.B svwaitdown
+checks each
+.I service
+given at the command line for being down.
+The
+.I services
+given at the command line must be controlled by
+.BR supervise (8).
+.P
+.B svwaitdown
+blocks, limited by a
+.IR timeout ,
+until all
+.I services
+are down or reports errors.
+.SH OPTIONS
+.TP
+.B \-v
+verbose. Print verbose messages to stderr.
+.TP
+.B \-t \fIsec
+Set the timeout for waiting for
+.I services
+to become down to
+.I sec
+seconds.
+.I sec
+must be between 2 and 6000. Default is 600 (10 minutes).
+.SH EXIT CODES
+.B svwaitdown
+returns 0 as soon as all
+.I services
+are down.
+.P
+If a
+.I service
+is usually controlled by
+.BR supervise (8),
+but no
+.BR supervise (8)
+process is currently running,
+.B svwaitdown
+treats this
+.I service
+as if it would be down.
+.P
+For each
+.I service
+that causes an error while checking,
+.B svwaitdown
+increases the exit code by one and exits non zero. The maximum is 100.
+.P
+.B svwaitdown
+returns 111 if the timeout
+.I sec
+was reached.
+.SH SEE ALSO
+svwaitup(8),
+supervise(8),
+svscan(8),
+runit(8),
+runit-init(8)
+.P
+ http://smarden.org/runit/
+ http://cr.yp.to/daemontools.html
+.SH AUTHOR
+Gerrit Pape <pape@smarden.org>
diff --git a/man/svwaitup.8 b/man/svwaitup.8
@@ -0,0 +1,73 @@
+.TH svwaitup 8
+.SH NAME
+svwaitup \- waits for services controlled by supervise(8) to be up
+.SH SYNOPSIS
+.B svwaitup
+[
+.B \-v
+]
+[
+.B \-s
+.I sec
+]
+.I services
+.SH DESCRIPTION
+.I services
+consist of one or more arguments.
+.P
+.B svwaitup
+checks each
+.I service
+given at the command line for being at least the specified number of seconds
+.I sec
+up. The
+.I services
+given at the command line must be controlled by
+.BR supervise (8).
+.P
+.B svwaitup
+blocks until all services are running the requested number of seconds or
+reports errors.
+.SH OPTIONS
+.TP
+.B \-v
+verbose. Print verbose messages to stderr.
+.TP
+.B \-s \fIsec
+Set the number of seconds the
+.I services
+have to be up to
+.I sec
+seconds.
+.I sec
+must be between 2 and 600. Default is 2.
+.SH EXIT CODES
+.B svwaitup
+returns 0 as soon as all
+.I services
+are at least
+.I sec
+seconds up.
+.P
+For each
+.I service
+that is down and not requested to become up, or that causes an error while
+checking (e.g.
+.BR supervise (8)
+is not running),
+.B svwaitup
+increases the exit code by one and exits non zero. The maximum is 100.
+.P
+.B svwaitup
+returns 111 on error.
+.SH SEE ALSO
+svwaitdown(8),
+supervise(8),
+svscan(8),
+runit(8),
+runit-init(8)
+.P
+ http://smarden.org/runit/
+ http://cr.yp.to/daemontools.html
+.SH AUTHOR
+Gerrit Pape <pape@smarden.org>
diff --git a/package/CHANGES b/package/CHANGES
@@ -1,7 +1,7 @@
runit 0.2.2
-Sat, 22 Dec 2001 20:37:03 +0100
+Sun, 23 Dec 2001 18:12:29 +0100
* runit: checks for pid == 1
- * new: svwaitdown, svwaitup
+ * new: svwaitdown, svwaitup, svwaitdown.8, svwaitup.8
* stage3: uses svwaitdown
* doc: runscripts.html added
diff --git a/src/init.c b/src/init.c
@@ -1,82 +0,0 @@
-#include <sys/types.h>
-#include <signal.h>
-#include <unistd.h>
-#include "strerr.h"
-#include "pathexec.h"
-#include "sig.h"
-#include "open.h"
-#include "error.h"
-
-#define USAGE " 0|6"
-#define WARNING "init: warning: "
-#define FATAL "init: fatal: "
-
-#define RUNIT "/sbin/runit"
-#define STOPIT "/etc/runit/stopit"
-#define REBOOT "/etc/runit/reboot"
-
-const char *progname;
-
-void usage(void) {
- strerr_die4x(1, "usage: ", progname, USAGE, "\n");
-}
-
-void runit_halt () {
- if (open_trunc(STOPIT) == -1) {
- strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
- }
- if (unlink(REBOOT) == -1) {
- if (errno != error_noent) {
- strerr_die4sys(111, FATAL, "unable to remove ", REBOOT, ": ");
- }
- }
- kill(1, sig_cont);
- exit(0);
-}
-void runit_reboot () {
- if (open_trunc(STOPIT) == -1) {
- strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
- }
- if (open_trunc(REBOOT) == -1) {
- strerr_die4sys(111, FATAL, "unable to create ", REBOOT, ": ");
- }
- kill(1, sig_cont);
- exit(0);
-}
-
-int main (int argc, const char * const *argv, const char * const *envp) {
- const char *prog[2];
-
- progname =*argv++;
-
- if (getpid() == 1) {
- prog[1] =0;
- prog[0] ="runit";
-
- /* kernel is starting init, runit does the job. */
- pathexec_run(RUNIT, (const char * const *) prog, envp);
-
- /* serious error */
- strerr_die4sys(111, FATAL, "unable to start ", prog[0], ": ");
- }
-
- if (! *argv || ! **argv) usage();
-
- switch (**argv) {
- case '0':
- runit_halt();
- break;
- case '6':
- runit_reboot();
- break;
- case '-':
- if ((*argv)[1] == 'V') {
- strerr_warn1("$Id$\n", 0);
- }
- default:
- usage();
- }
-
- /* not reached */
- exit(0);
-}
diff --git a/src/svwaitdown.c b/src/svwaitdown.c
@@ -17,7 +17,7 @@
#define FATAL "svwaitdown: fatal: "
#define WARNING "svwaitdown: warning: "
-#define INFO "svwaitdown: info: "
+#define INFO "svwaitdown: "
#define USAGE " [ -v ] [ -t 2..6000 ] service ..."
const char *progname;
diff --git a/src/svwaitup.c b/src/svwaitup.c
@@ -16,8 +16,8 @@
#define FATAL "svwaitup: fatal: "
#define WARNING "svwaitup: warning: "
-#define INFO "svwaitup: info: "
-#define USAGE " [ -s 2..600 ] service ..."
+#define INFO "svwaitup: "
+#define USAGE " [ -v ] [ -s 2..600 ] service ..."
const char *progname;
unsigned long sec;