runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 0f165ede1064aed457951b81154eb5cd4e4db7b2
parent 5b200db03274f4d3b10a2c1cc33370544ee04663
Author: Gerrit Pape <pape@smarden.org>
Date:   Sat,  3 May 2003 15:57:55 +0000

  * doc/dependencies.html, doc/useinit.html: new.
  * doc/index.html: adapt; reorder programs; runsvstat, runsvctrl installed
    by default.
  * doc/install.html: remove dependency on daemontools; create /package.
  * doc/replaceinit.html, man/runsv.8: typo.
  * man/svwaitdown.8, man/svwaitup.8: refer to runit and supervise.
  * svlogd.c: fix counter var namespace.
  * package/commands: add runsvctrl, runsvstat.

Diffstat:
Adoc/dependencies.html | 37+++++++++++++++++++++++++++++++++++++
Mdoc/index.html | 20+++++++++-----------
Mdoc/install.html | 15+++++++++++----
Mdoc/replaceinit.html | 2+-
Mdoc/upgrade.html | 2+-
Adoc/useinit.html | 47+++++++++++++++++++++++++++++++++++++++++++++++
Mman/runsv.8 | 2+-
Mman/svwaitdown.8 | 13+++++++------
Mman/svwaitup.8 | 6++++--
Mpackage/CHANGES | 11+++++++++++
Mpackage/commands | 2++
Msrc/svlogd.c | 6+++++-
12 files changed, 136 insertions(+), 27 deletions(-)

diff --git a/doc/dependencies.html b/doc/dependencies.html @@ -0,0 +1,37 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<title>runit -service dependencies</title> +</head> +<body> +<a href="http://smarden.org/pape/">G. Pape</a><br> +<a href="index.html">runit</a><br> +<hr> +<h1>runit - service dependencies</h1> +<hr> +<i>runit</i>'s service supervision resolves dependencies for service daemons +designed to be run by an supervisor process automatically. +The service daemon (or the corresponding <tt>run</tt> and <tt>finish</tt> +scripts) should behave as follows: +<ul> + <li>before providing the service, check if all services it depends on are + available. + If not, exit with an error, the supervisor will then try again. + <li>write all logs through <i>runit</i>'s logging facility. + The <a href="runsv.8.html">runsv</a> program takes care that all logs of + the service are written safely to disk. + Therefore there's no need to depend on a system logging service. + <li>optionally when the service is told to become down, take down other + services that depend on this one after disabling the service. +</ul> +If you want to run service daemons that do not support service supervision +as described above, please refer to +<a href="http://smarden.org/pape/djb/daemontools/noinit.html">this page</a> +about service dependencies I wrote some time ago. +<hr> +<address><a href="mailto:pape@smarden.org"> +Gerrit Pape &lt;pape@smarden.org&gt; +</a></address> +<small>$Id$</small> +</body> +</html> diff --git a/doc/index.html b/doc/index.html @@ -13,30 +13,28 @@ <p> <a href="benefits.html">Benefits</a><br> <a href="replaceinit.html">How to replace init</a><br> +<a href="useinit.html">How to use runit with current init</a><br> <a href="usedietlibc.html">How to use dietlibc</a> <p> <a href="runlevels.html">Runlevels</a><br> -<a href="http://smarden.org/pape/djb/daemontools/noinit.html"> -Dependencies</a><br> +<a href="dependencies.html">Service dependencies</a><br> <a href="runscripts.html">A collection of run scripts</a><br> <p> <a href="runit.8.html">The <tt>runit</tt> program</a><br> <a href="runit-init.8.html">The <tt>runit-init</tt> program</a><br> <br> <a href="runsvdir.8.html">The <tt>runsvdir</tt> program</a><br> -<a href="runsv.8.html">The <tt>runsv</tt> program</a><br> <a href="runsvchdir.8.html">The <tt>runsvchdir</tt> program</a><br> <br> +<a href="runsv.8.html">The <tt>runsv</tt> program</a><br> +<a href="runsvstat.8.html">The <tt>runsvstat</tt> program</a><br> +<a href="runsvctrl.8.html">The <tt>runsvctrl</tt> program</a><br> +<br> <a href="svlogd.8.html">The <tt>svlogd</tt> program</a><br> <br> -<a href="utmpset.8.html">The <tt>utmpset</tt> program</a><br> <a href="svwaitdown.8.html">The <tt>svwaitdown</tt> program</a><br> <a href="svwaitup.8.html">The <tt>svwaitup</tt> program</a><br> -<br> -<a href="runsvstat.8.html">The <tt>runsvstat</tt> program</a> -(not installed by default)<br> -<a href="runsvctrl.8.html">The <tt>runsvctrl</tt> program</a> -(not installed by default) +<a href="utmpset.8.html">The <tt>utmpset</tt> program</a><br> <hr> <i>runit</i> is a <a href="http://cr.yp.to/daemontools.html">daemontools</a> alike @@ -45,7 +43,7 @@ replacement for and other init schemes. <i>runit</i> runs on <b>GNU/Linux</b>, <b>OpenBSD</b>, <b>FreeBSD</b>, and can easily be adapted to other unix operating systems. -If <i>runit</i> runs for you on any other operating system or linux +If <i>runit</i> runs for you on any other operating system or Linux distribution, please let me know. <p> <b>Warning:</b> Replacing <i>sysvinit</i> or <i>init</i> can cause the @@ -87,7 +85,7 @@ if this is started by the kernel. <tt>/etc/runit/3</tt>. The systems tasks to shutdown and halt or reboot are done here. </ul> -These are working examples for debian woody: +These are working examples for Debian woody: <a href="debian/1">/etc/runit/1</a>, <a href="debian/2">/etc/runit/2</a>, <a href="debian/3">/etc/runit/3</a>. diff --git a/doc/install.html b/doc/install.html @@ -9,9 +9,13 @@ <hr> <h1>runit - installation</h1> <hr> -Check that you have the recent version of -<a href="http://cr.yp.to/daemontools.html">daemontools</a> installed. -<p> +<i>runit</i> installs into +<a href="http://cr.yp.to/slashpackage.html">/package</a>. +If you don't have a <tt>/package</tt> directory, create it now: +<pre> + # mkdir -p /package + # chmod 1755 /package +</pre> Download <a href="runit-0.9.1.tar.gz">runit-0.9.1.tar.gz</a> into <tt>/package</tt> and unpack the archive @@ -32,7 +36,10 @@ hierarchy, do: # package/install-man </pre> Refer to <a href="replaceinit.html">replacing init</a> for -replacing <i>init</i> with <i>runit</i>. +replacing <i>init</i> with <i>runit</i>, or to +<a href="useinit.html">use with traditional init</a> for running +<i>runit</i>'s service supervision with your system's current <i>init</i> +scheme. <hr> <address><a href="mailto:pape@smarden.org"> Gerrit Pape &lt;pape@smarden.org&gt; diff --git a/doc/replaceinit.html b/doc/replaceinit.html @@ -18,7 +18,7 @@ Follow these steps to migrate from <i>sysvinit</i> to <i>runit</i> on The <tt>/sbin/init</tt> binary is not replaced until step 6, <i>runit</i> is the default Unix process no 1 after step 7. <p> -If you have installed the precompiled debian package, start at step 3. +If you have installed the precompiled Debian package, start at step 3. <h3>Step 1: The three stages</h3> <i>runit</i> looks for the three stages implementing the system's <i>booting</i>, <i>running</i> and <i>shutdown</i> in <tt>/etc/runit/1</tt>, diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -10,7 +10,7 @@ <h1>runit - upgrading from previous versions</h1> <hr> -<h3>0.8.0 or 0.8.1 to 0.9.1</h3> +<h3>0.8.0 or 0.8.1 to 0.9.1 or 0.9.2</h3> The <a href="svlogd.8.html">svlogd</a> program is new. <i>svlogd</i> is a service logging daemon designed to be run from <tt>log/run</tt> files, similar to diff --git a/doc/useinit.html b/doc/useinit.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<title>runit - use with traditional init</title> +</head> +<body> +<a href="http://smarden.org/pape/">G. Pape</a><br> +<a href="index.html">runit</a><br> +<hr> +<h1>runit - use with traditional init</h1> +<hr> +It's possible to use <i>runit</i>'s service supervision without replacing +the <i>init</i> scheme of the system. +Simply run the <i>stage 2</i> of <i>runit</i> as a service with your +current <i>init</i>. +<p> +Normally this is done by either adding <tt>/etc/runit/2</tt> as command to +</tt>/etc/rc.local</tt>, or by adding an entry for <tt>/etc/runit/2</tt> to +<tt>/etc/inittab</tt>. +<hr> +If your system uses a sysvinit alike init scheme with a <tt>/etc/inittab</tt> +file, do: +<pre> + # cat &gt;&gt;/etc/inittab &lt;&lt;EOT + SV:123456:respawn:/etc/runit/2 + EOT +</pre> +and tell <i>init</i> to reread its configuration, e.g.: +<pre> + # init q +</pre> +<hr> +If your system uses a BSD alike init scheme with a <tt>/etc/rc.local</tt> +script, do: +<pre> + # cat &gt;&gt;/etc/rc.local &lt;&lt;EOT + /etc/runit/2 &amp; + EOT +</pre> +and reboot your system. +<hr> +<address><a href="mailto:pape@smarden.org"> +Gerrit Pape &lt;pape@smarden.org&gt; +</a></address> +<small>$Id$</small> +</body> +</html> diff --git a/man/runsv.8 b/man/runsv.8 @@ -18,7 +18,7 @@ starts ./finish. If ./finish doesn't exist or ./finish exits, .B runsv restarts ./run. .P -If ./run or ./finish exit immediatly, +If ./run or ./finish exit immediately, .B runsv waits a second before starting ./finish or restarting ./run. .P diff --git a/man/svwaitdown.8 b/man/svwaitdown.8 @@ -1,6 +1,6 @@ .TH svwaitdown 8 .SH NAME -svwaitdown \- waits for services controlled by supervise(8) to be down +svwaitdown \- waits for services controlled by runsv(8) or supervise(8) to be down .SH SYNOPSIS .B svwaitdown [ @@ -26,6 +26,8 @@ down. The .I services given at the command line must be controlled by +.BR runsv (8), +or .BR supervise (8). .P .B svwaitdown @@ -52,7 +54,7 @@ must be between 2 and 6000. Default is 600 (10 minutes). Kill. If the timeout is reached before all .I services are down, tell the -.BR supervise (8) +.BR runsv (8) processes to send the .I services a KILL signal. @@ -71,7 +73,6 @@ This option should only be used by in stage 3 when .BR runsvdir (8) is already stopped. - .SH EXIT CODES .B svwaitdown returns 0 as soon as all @@ -81,10 +82,10 @@ are down. If a .I service is usually controlled by +.B runsv (8) +or .BR supervise (8), -but no -.BR supervise (8) -process is currently running, +but no supervisor process is currently running, .B svwaitdown treats this .I service diff --git a/man/svwaitup.8 b/man/svwaitup.8 @@ -1,6 +1,6 @@ .TH svwaitup 8 .SH NAME -svwaitup \- waits for services controlled by supervise(8) to be up +svwaitup \- waits for services controlled by runsv(8) or supervise(8) to be up .SH SYNOPSIS .B svwaitup [ @@ -25,6 +25,8 @@ given at the command line for being at least the specified number of seconds up. The .I services given at the command line must be controlled by +.BR runsv (8), +or .BR supervise (8). .P .B svwaitup @@ -77,7 +79,7 @@ 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) +.BR runsv (8) is not running), .B svwaitup increases the exit code by one and exits non zero. The maximum is 100. diff --git a/package/CHANGES b/package/CHANGES @@ -1,3 +1,14 @@ +runit 0.9.2 +Sat, 03 May 2003 17:40:23 +0200 + * doc/dependencies.html, doc/useinit.html: new. + * doc/index.html: adapt; reorder programs; runsvstat, runsvctrl installed + by default. + * doc/install.html: remove dependency on daemontools; create /package. + * doc/replaceinit.html, man/runsv.8: typo. + * man/svwaitdown.8, man/svwaitup.8: refer to runit and supervise. + * svlogd.c: fix counter var namespace. + * package/commands: add runsvctrl, runsvstat. + runit 0.9.1 Wed, 30 Apr 2003 22:10:57 +0200 * svlogd.c: reset match flag on deselection, fixes pattern matching. diff --git a/package/commands b/package/commands @@ -4,6 +4,8 @@ runsv runsvdir runsvchdir svwaitdown +runsvctrl +runsvstat svwaitup svlogd utmpset diff --git a/src/svlogd.c b/src/svlogd.c @@ -49,7 +49,6 @@ char repl =0; const char **fndir; int fdwdir; struct stat st; -int i; stralloc sa; int wstat; struct taia now; @@ -283,6 +282,8 @@ void logdir_close(struct logdir *ld) { } unsigned int logdir_open(struct logdir *ld, const char *fn) { + int i; + if ((ld->fddir =open_read(fn)) == -1) { warn2("unable to open log directory", (char*)fn); return(0); @@ -404,6 +405,8 @@ void logdirs_reopen(void) { } unsigned int linestart(struct logdir *ld, char *s, int len) { + int i; + /* check inst, set match */ ld->match ='+'; if (ld->inst.len) { @@ -512,6 +515,7 @@ void sig_hangup_handler(void) { } int main(int argc, const char **argv) { + int i; int opt; unsigned int eol;