commit 0c58079d7acf03565d8f596f4c5c572a19f86cb6
parent bf6958dba03c31dfc3cecac96a901d2dd14447a0
Author: Gerrit Pape <pape@smarden.org>
Date: Sun, 6 Oct 2002 09:53:55 +0000
0.6.4.
Diffstat:
15 files changed, 92 insertions(+), 83 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,6 +1,6 @@
DESTDIR=
-PACKAGE=runit-0.6.3
+PACKAGE=runit-0.6.4
DIRS=doc man etc package src
MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 svwaitdown.8 svwaitup.8 \
utmpset.8 runsvchdir.8
diff --git a/debian/changelog b/debian/changelog
@@ -1,10 +1,10 @@
-runit (0.6.3-1) sarge; urgency=low
+runit (0.6.4-1) sarge; urgency=low
* See /package/admin/runit/package/CHANGES.
* preinst: new; create hardlink /sbin/runit.old -> /sbin/runit on
upgrade.
- -- Gerrit Pape <pape@smarden.org> Fri, 4 Oct 2002 11:59:42 +0200
+ -- Gerrit Pape <pape@smarden.org> Sun, 6 Oct 2002 11:41:41 +0200
runit (0.6.0-1) sarge; urgency=low
diff --git a/debian/postinst b/debian/postinst
@@ -25,7 +25,7 @@ set -e
case "$1" in
configure)
( \
- cd /package/admin/runit-0.6.3
+ cd /package/admin/runit-0.6.4
package/upgrade
)
;;
diff --git a/debian/rules b/debian/rules
@@ -23,15 +23,15 @@ build-stamp:
# $(MAKE)
#/usr/bin/docbook-to-man debian/runit.sgml > runit.1
- tar xfzvp runit-0.6.3.tar.gz
+ tar xfzvp runit-0.6.4.tar.gz
( \
- cd admin/runit-0.6.3 ; \
+ cd admin/runit-0.6.4 ; \
echo 'diet gcc -O2 -Wall' > src/conf-cc ; \
echo 'diet gcc -s -Os -pipe' > src/conf-ld ; \
package/compile ; \
- echo "/package/admin/runit-0.6.3" > compile/home ; \
+ echo "/package/admin/runit-0.6.4" > compile/home ; \
rm -f compile/src ; \
- ln -s /package/admin/runit-0.6.3/src compile/src ; \
+ ln -s /package/admin/runit-0.6.4/src compile/src ; \
)
touch build-stamp
@@ -58,40 +58,40 @@ install: build
chmod 1755 debian/runit/package
cp -a admin debian/runit/package/
- rm -rf debian/runit/package/admin/runit-0.6.3/compile
- cp -a debian/runit/package/admin/runit-0.6.3/man .
- rm -rf debian/runit/package/admin/runit-0.6.3/man
- cp -a debian/runit/package/admin/runit-0.6.3/doc .
- rm -rf debian/runit/package/admin/runit-0.6.3/doc
- cp -a debian/runit/package/admin/runit-0.6.3/etc .
- rm -rf debian/runit/package/admin/runit-0.6.3/etc
- cp -a debian/runit/package/admin/runit-0.6.3/package .
+ rm -rf debian/runit/package/admin/runit-0.6.4/compile
+ cp -a debian/runit/package/admin/runit-0.6.4/man .
+ rm -rf debian/runit/package/admin/runit-0.6.4/man
+ cp -a debian/runit/package/admin/runit-0.6.4/doc .
+ rm -rf debian/runit/package/admin/runit-0.6.4/doc
+ cp -a debian/runit/package/admin/runit-0.6.4/etc .
+ rm -rf debian/runit/package/admin/runit-0.6.4/etc
+ cp -a debian/runit/package/admin/runit-0.6.4/package .
# /etc/runit
- cp -p admin/runit-0.6.3/etc/debian/[123] \
+ cp -p admin/runit-0.6.4/etc/debian/[123] \
debian/runit/etc/runit/
- cp -p admin/runit-0.6.3/etc/debian/ctrlaltdel \
+ cp -p admin/runit-0.6.4/etc/debian/ctrlaltdel \
debian/runit/etc/runit/
- cp -p admin/runit-0.6.3/etc/debian/getty-tty5/run \
+ cp -p admin/runit-0.6.4/etc/debian/getty-tty5/run \
debian/runit/etc/runit/getty-5/run
# runit programs
- cp -p debian/runit/package/admin/runit-0.6.3/command/runit* \
+ cp -p debian/runit/package/admin/runit-0.6.4/command/runit* \
debian/runit/sbin/
# cleanup
- rm -rf debian/runit/package/admin/runit-0.6.3/compile
+ rm -rf debian/runit/package/admin/runit-0.6.4/compile
# create debian/links
rm -f debian/links
for i in \
- `cat debian/runit/package/admin/runit-0.6.3/package/commands` ; \
+ `cat debian/runit/package/admin/runit-0.6.4/package/commands` ; \
do \
echo "/package/admin/runit/command/$$i /command/$$i" \
>> debian/links ; \
done
for i in \
- `cat debian/runit/package/admin/runit-0.6.3/package/commands` ; \
+ `cat debian/runit/package/admin/runit-0.6.4/package/commands` ; \
do \
echo "/command/$$i /usr/local/bin/$$i" \
>> debian/links ; \
diff --git a/doc/install.html b/doc/install.html
@@ -13,14 +13,14 @@ Check that you have the recent version of
<a href="http://cr.yp.to/daemontools.html">daemontools</a> installed.
<p>
Download
-<a href="runit-0.6.3.tar.gz">runit-0.6.3.tar.gz</a> into <tt>/package</tt>
+<a href="runit-0.6.4.tar.gz">runit-0.6.4.tar.gz</a> into <tt>/package</tt>
and unpack the archive
<pre>
# cd /package
- # gunzip runit-0.6.3.tar
- # tar -xpf runit-0.6.3.tar
- # rm runit-0.6.3.tar
- # cd admin/runit-0.6.3
+ # gunzip runit-0.6.4.tar
+ # tar -xpf runit-0.6.4.tar
+ # rm runit-0.6.4.tar
+ # cd admin/runit-0.6.4
</pre>
Compile and install the <i>runit</i> programs
<pre>
diff --git a/doc/replaceinit.html b/doc/replaceinit.html
@@ -107,7 +107,7 @@ default Unix process no 1 <i>runit</i>.
</pre>
To report success:
<pre>
- # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.6.3@smarden.org
+ # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.6.4@smarden.org
</pre>
<hr>
@@ -188,7 +188,7 @@ Use <b>init 6</b> to reboot and <b>init 0</b> to halt a system that runs
<p>
To report success:
<pre>
- # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.6.3@smarden.org
+ # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.6.4@smarden.org
</pre>
<h3>Step 5: Service migration</h3>
The goal is to migrate all services from <i>/etc/rc.*</i> scheme to the
diff --git a/doc/runlevels.html b/doc/runlevels.html
@@ -54,10 +54,10 @@ services a SIGTERM and wait for them to terminate. You can check the status
of the <tt>previous</tt> runlevel in <tt>/etc/runit/runsvdir/previous/</tt>.
<hr>
<a name="create"><h3>Creating new runlevels</h3></a>
-To create a new runlevel, simply create a new service directory in
-<tt>/etc/runit/runsvdir</tt>. The name of the runlevel must not start with
-a dot and must not be <tt>current</tt>, <tt>current.new</tt> or
-<tt>previous</tt>. E.g.:
+To create a new runlevel, simply create a new directory in
+<tt>/etc/runit/runsvdir</tt>. The name of the directory is the name of
+the new runlevel. The name must not start with a dot and must not be
+<tt>current</tt>, <tt>current.new</tt> or <tt>previous</tt>. E.g.:
<pre>
# mkdir /etc/runit/runsvdir/maintenance
</pre>
@@ -68,7 +68,7 @@ newly created directory, e.g.:
# ln -s /etc/runit/runsv/ssh /etc/runit/runsvdir/maintenance/
# ln -s /etc/runit/runsv/dnscache /etc/runit/runsvdir/maintenance/
</pre>
-If you want to switch to the runlevel <tt>mainenance</tt>, do:
+If you want to switch to the runlevel <tt>maintenance</tt>, do:
<pre>
# runsvchdir maintenance
</pre>
diff --git a/doc/runsvdir.8.html b/doc/runsvdir.8.html
@@ -37,10 +37,10 @@ is started by <B><I>runit</B>(8)</I> in stage 2.
<H2><A NAME="sect3">Signals</A></H2>
If <B>runsvdir</B> receives a TERM signal,
it sends a TERM signal to each <B><I>runsv</B>(8)</I> process it is monitoring and then
-exits.
+exits with 0.
<H2><A NAME="sect4">See Also</A></H2>
-<I>runit(8)</I>, <I>runit-init(8)</I>, <I>runsv(8)</I>, <I>readproctitle(8)</I>, <I>svscan(8)</I>
-<P>
+<I>runit(8)</I>, <I>runit-init(8)</I>, <I>runsv(8)</I>, <I>readproctitle(8)</I>,
+<I>svscan(8)</I> <P>
<I>http://smarden.org/runit/</I><BR>
<I>http://cr.yp.to/daemontools.html</I><BR>
diff --git a/man/runsvdir.8 b/man/runsvdir.8
@@ -75,7 +75,7 @@ If
.B runsvdir
receives a TERM signal, it sends a TERM signal to each
.BR runsv (8)
-process it is monitoring and then exits.
+process it is monitoring and then exits with 0.
.SH SEE ALSO
runit(8),
runit-init(8),
diff --git a/package/CHANGES b/package/CHANGES
@@ -1,10 +1,12 @@
-runit 0.6.3
-Fri, 04 Oct 2002 10:57:02 +0200
- * runsv.c: sleep 1 second before exiting on fatal error.
+runit 0.6.4
+Sun, 06 Oct 2002 11:41:29 +0200
* runsvdir.c: check service directory's inode and device in addition
- to mtime; sleep 1 second if stat(service directory) fails.
- * runsvstat.c: new option -l: only show log service if -l is set.
- * runsvchdir: new; change service directory runsvdir is running in.
+ to mtime; sleep at least 1 second before restarting run svprocesses.
+ * runsv.c: use status[19] for state information; control pipe supports e.
+ * runsvstat.c: new option -l: only show log service if -l is given; use
+ status[19] for state.
+ * runsvchdir: new; change directory runsvdir is running in (switch
+ runlevels).
* man/runsvchdir.8, doc/runsvchdir.8.html: new.
runit 0.6.0
diff --git a/package/upgrade b/package/upgrade
@@ -7,9 +7,9 @@ test -d src || ( echo 'Wrong working directory.'; exit 1 )
here=`env - PATH=$PATH pwd`
parent=`dirname $here`
-echo 'Creating symlink runit -> runit-0.6.3...'
+echo 'Creating symlink runit -> runit-0.6.4...'
rm -f runit
-ln -s runit-0.6.3 runit
+ln -s runit-0.6.4 runit
mv -f runit ..
echo 'Making command links in /command...'
diff --git a/src/runsv.c b/src/runsv.c
@@ -61,14 +61,10 @@ void usage () {
strerr_die4x(1, "usage: ", progname, USAGE, "\n");
}
void fatal(char *m) {
- strerr_warn5("runsv ", dir, ": fatal: ", m, ": ", &strerr_sys);
- sleep(1);
- exit(111);
+ strerr_die5sys(111, "runsv ", dir, ": fatal: ", m, ": ");
}
void fatal2(char *m1, char *m2) {
- strerr_warn6("runsv ", dir, ": fatal: ", m1, m2, ": ", &strerr_sys);
- sleep(1);
- exit(111);
+ strerr_die6sys(111, "runsv ", dir, ": fatal: ", m1, m2, ": ");
}
void warn(char *m) {
strerr_warn5("runsv ", dir, ": warning: ", m, ": ", &strerr_sys);
@@ -91,7 +87,7 @@ void s_term() {
void update_status(struct svdir *s) {
unsigned long l;
int fd;
- char status[19];
+ char status[20];
char bspace[64];
buffer b;
char spid[FMT_ULONG];
@@ -183,6 +179,7 @@ void update_status(struct svdir *s) {
status[18] =1;
else
status[18] =0;
+ status[19] =s->state;
if ((fd =open_trunc("supervise/status.new")) == -1) {
warn("unable to open supervise/status.new");
return;
diff --git a/src/runsvctrl.c b/src/runsvctrl.c
@@ -3,7 +3,7 @@
#include "error.h"
#include "open.h"
-#define USAGE " u|d|o|p|c|h|a|i|1|2|t|k|x service ..."
+#define USAGE " u|d|o|p|c|h|a|i|1|2|t|k|x|e service ..."
#define VERSION "$Id$"
@@ -55,8 +55,8 @@ int main(int argc, char **argv) {
if (! argv || ! *argv) usage();
switch ((c =**argv)) {
- case 'u': case 'd': case 'o': case 'x': case 'p': case 'c': case 'h':
- case 'a': case 'i': case 't': case 'k': case '1': case '2':
+ case 'u': case 'd': case 'o': case 'x': case 'e': case 'p': case 'c':
+ case 'h': case 'a': case 'i': case 't': case 'k': case '1': case '2':
break;
default:
usage();
diff --git a/src/runsvdir.c b/src/runsvdir.c
@@ -66,9 +66,6 @@ void runsv(int no, char *name) {
/* child */
const char *prog[3];
- if (chdir(svdir) == -1)
- fatal("unable to change directory to", svdir);
-
prog[0] ="runsv";
prog[1] =name;
prog[2] =0;
@@ -173,6 +170,7 @@ int main(int argc, char **argv) {
int pid;
struct taia deadline;
struct taia now;
+ struct taia stampcheck;
char ch;
int i;
@@ -191,6 +189,8 @@ int main(int argc, char **argv) {
if ((curdir =open_read(".")) == -1)
fatal("unable to open current directory", 0);
+ taia_now(&stampcheck);
+
for (;;) {
/* collect children */
for (;;) {
@@ -204,28 +204,34 @@ int main(int argc, char **argv) {
}
}
}
- if (stat(svdir, &s) != -1) {
- if (check || s.st_mtime > mtime || s.st_ino != ino || s.st_dev != dev) {
- /* svdir modified */
- mtime =s.st_mtime;
- dev =s.st_dev;
- ino =s.st_ino;
- check =0;
- if (chdir(svdir) == -1)
- warn("unable to change directory to", svdir);
- else {
- runsvdir();
- if (fchdir(curdir) == -1)
- warn("unable to change directory", 0);
- }
+
+ taia_now(&now);
+ if (taia_less(&now, &stampcheck) == 0) {
+ /* wait at least a second */
+ taia_uint(&deadline, 1);
+ taia_add(&stampcheck, &now, &deadline);
+
+ if (stat(svdir, &s) != -1) {
+ if (check || \
+ s.st_mtime > mtime || s.st_ino != ino || s.st_dev != dev) {
+ /* svdir modified */
+ mtime =s.st_mtime;
+ dev =s.st_dev;
+ ino =s.st_ino;
+ check =0;
+ if (chdir(svdir) == -1)
+ warn("unable to change directory to ", svdir);
+ else {
+ runsvdir();
+ if (fchdir(curdir) == -1)
+ warn("unable to change directory", 0);
+ }
+ }
}
- }
- else {
- warn("unable to stat ", svdir);
- sleep(1);
+ else
+ warn("unable to stat ", svdir);
}
- taia_now(&now);
if (log)
if (taia_less(&now, &stamplog) == 0) {
write(logpipe[1], ".", 1);
diff --git a/src/runsvstat.c b/src/runsvstat.c
@@ -37,7 +37,7 @@ void warnx(char *m1, char *m2) {
}
int show_status(char *name) {
- char status[19];
+ char status[20];
int pid;
int fd;
int normallyup =0;
@@ -64,8 +64,8 @@ int show_status(char *name) {
warn(name, "unable to open supervise/status");
return(-1);
}
- switch(read(fd, status, 19)) {
- case 19:
+ switch(read(fd, status, 20)) {
+ case 20:
break;
case -1:
warn(name, "unable to read supervise/status");
@@ -87,7 +87,11 @@ int show_status(char *name) {
buffer_puts(buffer_1, name);
buffer_puts(buffer_1, ": ");
if (pid) {
- buffer_puts(buffer_1, "up (pid ");
+ switch (status[19]) {
+ case 1: buffer_puts(buffer_1, "run "); break;
+ case 2: buffer_puts(buffer_1, "finish "); break;
+ }
+ buffer_puts(buffer_1, "(pid ");
buffer_put(buffer_1, sulong, fmt_ulong(sulong, pid));
buffer_puts(buffer_1, ") ");
}