runit

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

commit 749861ac1e7a2bf0296f1aed011ce11b26d3c11a
parent 2ff1fcfd448dc6ee6a54ccde135ee8543eec47e2
Author: Gerrit Pape <pape@smarden.org>
Date:   Mon,  8 Mar 2004 12:37:10 +0000

  * check-diff, check-dist, check-local, package/check: new; run checks on
    programs.
  * package/install: run package/check.
  * chpst.check, runit-init.check, runit.check, runsv.check,
    runsvchdir.check, runsvctrl.check, runsvdir.check, runsvstat.check,
    svlogd.check, svwaitdown.check, svwaitup.check, utmpset.check: new;
    check program.
  * chpst.dist, runit-init.dist, runit.dist, runsv.dist, runsvchdir.dist,
    runsvctrl.dist, runsvdir.dist, runsvstat.dist, svlogd.dist,
    svwaitdown.dist, svwaitup.dist, utmpset.dist: new; dist check program
    output.
1.0.1

Diffstat:
MMakefile | 2+-
Mdebian/changelog | 6++++++
Mdebian/rules | 6+++---
Mdoc/chpst.8.html | 37+++++++++++++++++++------------------
Mdoc/svlogd.8.html | 4++--
Mman/chpst.8 | 3++-
Mpackage/CHANGES | 15++++++++++++++-
Apackage/check | 8++++++++
Mpackage/install | 1+
Mpackage/upgrade | 4++--
Mpackage/versions | 1+
Msrc/Makefile | 9++++++---
Msrc/TARGETS | 13+++++++++++++
Asrc/check-diff | 5+++++
Asrc/check-dist | 8++++++++
Asrc/check-local | 9+++++++++
Asrc/chpst.check | 36++++++++++++++++++++++++++++++++++++
Asrc/chpst.dist | 13+++++++++++++
Asrc/runit-init.check | 3+++
Asrc/runit-init.dist | 3+++
Asrc/runit.check | 3+++
Asrc/runit.dist | 2++
Asrc/runsv.check | 45+++++++++++++++++++++++++++++++++++++++++++++
Asrc/runsv.dist | 10++++++++++
Asrc/runsvchdir.check | 3+++
Asrc/runsvchdir.dist | 3+++
Asrc/runsvctrl.check | 23+++++++++++++++++++++++
Asrc/runsvctrl.dist | 8++++++++
Asrc/runsvdir.check | 3+++
Asrc/runsvdir.dist | 3+++
Asrc/runsvstat.check | 26++++++++++++++++++++++++++
Asrc/runsvstat.dist | 12++++++++++++
Asrc/svlogd.check | 21+++++++++++++++++++++
Asrc/svlogd.dist | 20++++++++++++++++++++
Asrc/svwaitdown.check | 24++++++++++++++++++++++++
Asrc/svwaitdown.dist | 12++++++++++++
Asrc/svwaitup.check | 28++++++++++++++++++++++++++++
Asrc/svwaitup.dist | 14++++++++++++++
Asrc/utmpset.check | 5+++++
Asrc/utmpset.dist | 7+++++++
40 files changed, 427 insertions(+), 31 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,6 +1,6 @@ DESTDIR= -PACKAGE=runit-1.0.0 +PACKAGE=runit-1.0.1 DIRS=doc man etc package src MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 svwaitdown.8 svwaitup.8 \ utmpset.8 runsvchdir.8 runsvstat.8 runsvctrl.8 svlogd.8 chpst.8 diff --git a/debian/changelog b/debian/changelog @@ -1,3 +1,9 @@ +runit (1.0.1-0.1) unstable; urgency=low + + * new upstream release. + + -- Gerrit Pape <pape@smarden.org> Sun, 22 Feb 2004 08:26:24 +0000 + runit (1.0.0-1) unstable; urgency=low * upstream stable release. diff --git a/debian/rules b/debian/rules @@ -40,10 +40,10 @@ DIR =`pwd`/debian/runit build: deb-checkdir build-stamp build-stamp: - tar xfzp runit-1.0.0.tar.gz + tar xfzp runit-1.0.1.tar.gz -gcc -v - ( cd admin/runit-1.0.0/src && \ - ln -s runit-1.0.0 runit && mv runit ../.. && \ + ( cd admin/runit-1.0.1/src && \ + ln -s runit-1.0.1 runit && mv runit ../.. && \ echo "$(CC) $(CFLAGS)" >conf-cc && \ echo "$(CC) $(LDFLAGS)" >conf-ld && \ $(MAKE) ) diff --git a/doc/chpst.8.html b/doc/chpst.8.html @@ -75,36 +75,37 @@ size to <i>bytes</i> bytes. </dd> <i>bytes</i> bytes. </dd> <dt><b>-v</b> </dt> -<dd>verbose. Print warnings about limits unsupported by the system -to standard error. </dd> +<dd>verbose. Print verbose messages to standard error. This includes +warnings about limits unsupported by the system. </dd> <dt><b>-P</b> </dt> -<dd>pgrphack. Run <i>prog</i> in a new process group. </dd> +<dd>pgrphack. Run <i>prog</i> in +a new process group. </dd> <dt><b>-0</b> </dt> -<dd>Close standard -input before running <i>prog</i>. </dd> +<dd>Close standard input before running <i>prog</i>. </dd> <dt><b>-1</b> </dt> -<dd>Close standard output before running <i>prog</i>. </dd> +<dd>Close +standard output before running <i>prog</i>. </dd> -<dt><b>-2</b> -</dt> -<dd>Close standard error before running <i>prog</i>. </dd> +<dt><b>-2</b> </dt> +<dd>Close standard error before running +<i>prog</i>. </dd> </dl> <h2><a name='sect4'>Exit Codes</a></h2> -<b>chpst</b> exits 100 when -called with wrong options. It prints an error message and exits 111 if it -has trouble changing the process state. Otherwise its exit code is the same -as that of <i>prog</i>. +<b>chpst</b> exits 100 when called with wrong options. It prints +an error message and exits 111 if it has trouble changing the process state. +Otherwise its exit code is the same as that of <i>prog</i>. <h2><a name='sect5'>Emulation</a></h2> -If <b>chpst</b> is called as <i><b>envdir</b>(8)</i>, <i><b>envuidgid</b>(8)</i>, -<i><b>pgrphack</b>(8)</i>, <i><b>setlock</b>(8)</i>, <i><b>setuidgid</b>(8)</i>, or <i><b>softlimit</b>(8)</i>, it emulates the -functionality of these programs from the daemontools package respectively. - +If <b>chpst</b> is +called as <i><b>envdir</b>(8)</i>, <i><b>envuidgid</b>(8)</i>, <i><b>pgrphack</b>(8)</i>, <i><b>setlock</b>(8)</i>, <i><b>setuidgid</b>(8)</i>, +or <i><b>softlimit</b>(8)</i>, it emulates the functionality of these programs from the +daemontools package respectively. <h2><a name='sect6'>See Also</a></h2> -<i>runsv(8)</i>, <i>runsvctrl(8)</i>, <i>runsvstat(8)</i>, <i>runsvdir(8)</i>, <i>setsid(2)</i> <p> +<i>runsv(8)</i>, <i>runsvctrl(8)</i>, <i>runsvstat(8)</i>, +<i>runsvdir(8)</i>, <i>setsid(2)</i> <p> <i>http://smarden.org/runit/</i><br> <i>http://cr.yp.to/daemontools.html</i><br> diff --git a/doc/svlogd.8.html b/doc/svlogd.8.html @@ -147,8 +147,8 @@ precise timestamp (see <i><b>tai64n</b>(8)</i>) when writing to <i>log</i> or to <dt><b>-tt</b> </dt> <dd>timestamp. Prefix each selected line with a human readable, sortable -timestamp of the form YYYY-MM-DD_HH:MM:SS.xxxxx when writing to <i>log</i> or to -standard error. </dd> +UTC timestamp of the form YYYY-MM-DD_HH:MM:SS.xxxxx when writing to <i>log</i> or +to standard error. </dd> <dt><b>-r <i>c</b> </i></dt> <dd>replace. <i>c</i> must be a single character. Replace non-printable diff --git a/man/chpst.8 b/man/chpst.8 @@ -143,7 +143,8 @@ bytes. .TP .B \-v verbose. -Print warnings about limits unsupported by the system to standard error. +Print verbose messages to standard error. +This includes warnings about limits unsupported by the system. .TP .B \-P pgrphack. diff --git a/package/CHANGES b/package/CHANGES @@ -1,7 +1,20 @@ +runit 1.0.1 +Sun, 07 Mar 2004 10:07:06 +0000 * fmt_ptime.c: create timestamps in UTC, not localtime. * chpst.c: -e dir: silently ignore directories, print warning if verbose. - * runsv.c: allow log/supervise also to be a dangling symlink; more + * runsv.c: allow also log/supervise to be a dangling symlink; more meaningful error message if opening lock or locking fails. + * check-diff, check-dist, check-local, package/check: new; run checks on + programs. + * package/install: run package/check. + * chpst.check, runit-init.check, runit.check, runsv.check, + runsvchdir.check, runsvctrl.check, runsvdir.check, runsvstat.check, + svlogd.check, svwaitdown.check, svwaitup.check, utmpset.check: new; + check program. + * chpst.dist, runit-init.dist, runit.dist, runsv.dist, runsvchdir.dist, + runsvctrl.dist, runsvdir.dist, runsvstat.dist, svlogd.dist, + svwaitdown.dist, svwaitup.dist, utmpset.dist: new; dist check program + output. runit 1.0.0 Tue, 10 Feb 2004 13:37:28 +0000 diff --git a/package/check b/package/check @@ -0,0 +1,8 @@ +#!/bin/sh -e + +umask 022 +test -d package || ( echo 'Wrong working directory.'; exit 1 ) || exit 1 +test -d compile || ( echo 'Wrong working directory.'; exit 1 ) || exit 1 + +echo 'Checking commands in ./command...' +( cd compile; exec make check ) || exit 1 diff --git a/package/install b/package/install @@ -1,4 +1,5 @@ #!/bin/sh -e package/compile +package/check package/upgrade diff --git a/package/upgrade b/package/upgrade @@ -7,9 +7,9 @@ test -d src || ( echo 'Wrong working directory.'; exit 1 ) || exit 1 here=`env - PATH=$PATH pwd` parent=`dirname $here` -echo 'Creating symlink runit -> runit-1.0.0...' +echo 'Creating symlink runit -> runit-1.0.1...' rm -f runit -ln -s runit-1.0.0 runit +ln -s runit-1.0.1 runit mv -f runit .. echo 'Making command links in /command...' diff --git a/package/versions b/package/versions @@ -24,3 +24,4 @@ 0.13.0 0.13.1 1.0.0 +1.0.1 diff --git a/src/Makefile b/src/Makefile @@ -1,7 +1,10 @@ -IT=sysdeps runit runit-init runsv runsvctrl runsvstat runsvdir runsvchdir \ -svwaitup svwaitdown utmpset svlogd chpst +IT=chpst runit runit-init runsv runsvchdir runsvctrl runsvdir runsvstat \ + svlogd svwaitdown svwaitup utmpset -default: $(IT) +default: sysdeps $(IT) + +check: $(IT) + ./check-local $(IT) runit: load runit.o unix.a byte.a ./load runit unix.a byte.a -static diff --git a/src/TARGETS b/src/TARGETS @@ -30,6 +30,7 @@ uw_tmp.h socket.lib trysocketlib trysocketlib.o +check alloc.o alloc_re.o buffer.o @@ -125,3 +126,15 @@ uint64.h unix.a wait_nohang.o wait_pid.o +chpst.local +runit-init.local +runit.local +runsv.local +runsvchdir.local +runsvctrl.local +runsvdir.local +runsvstat.local +svlogd.local +svwaitdown.local +svwaitup.local +utmpset.local diff --git a/src/check-diff b/src/check-diff @@ -0,0 +1,5 @@ +#!/bin/sh +while read i; do + read j 0<&7 || exit 1 + test "$i" = "$j" || exit 1 +done 7<$1.dist <$1.local diff --git a/src/check-dist b/src/check-dist @@ -0,0 +1,8 @@ +#!/bin/sh + +PATH=`pwd`:$PATH + +for i in `cat ../package/commands`; do + echo "Creating new $i.dist..." + env - PATH="$PATH" ctmp="`pwd`/check-tmp" $i.check 2>&1 |cat -v >$i.dist +done diff --git a/src/check-local b/src/check-local @@ -0,0 +1,9 @@ +#!/bin/sh + +PATH=`pwd`:$PATH + +for i in ${1+"$@"}; do + echo "Checking $i..." + env - PATH="$PATH" ctmp="`pwd`/check-tmp" $i.check 2>&1 |cat -v >$i.local + ./check-diff $i || ( cat $i.local; echo "$i failed."; exit 1 ) || exit 1 +done diff --git a/src/chpst.check b/src/chpst.check @@ -0,0 +1,36 @@ +#!/bin/sh +rm -rf "${ctmp}" + +chpst +echo $? +chpst -V +echo $? + +# -u +# -U + +mkdir "${ctmp}" +echo 1 >"${ctmp}"/test +chpst -e"${ctmp}" env |sed -ne '/^test=1$/p' +echo $? +rm -rf "${ctmp}" + +chpst -l"${ctmp}" true +echo $? +rm -f "${ctmp}" + +chpst -L"${ctmp}" true +echo $? +rm -f "${ctmp}" + +# -m +# -o +# -p +# -f +# -c + +chpst -P true +echo $? + +chpst -012 true +echo $? diff --git a/src/chpst.dist b/src/chpst.dist @@ -0,0 +1,13 @@ +usage: chpst [-vP012] [-u user[:group]] [-U user[:group]] [-e dir] [-l|-L lock] [-m n] [-o n] [-p n] [-f n] [-c n] prog + +100 +$Id$ +usage: chpst [-vP012] [-u user[:group]] [-U user[:group]] [-e dir] [-l|-L lock] [-m n] [-o n] [-p n] [-f n] [-c n] prog + +100 +test=1 +0 +0 +0 +0 +0 diff --git a/src/runit-init.check b/src/runit-init.check @@ -0,0 +1,3 @@ +#!/bin/sh +runit-init +echo $? diff --git a/src/runit-init.dist b/src/runit-init.dist @@ -0,0 +1,3 @@ +usage: runit-init 0|6 + +0 diff --git a/src/runit.check b/src/runit.check @@ -0,0 +1,3 @@ +#!/bin/sh +runit +echo $? diff --git a/src/runit.dist b/src/runit.dist @@ -0,0 +1,2 @@ +- runit: fatal: must be run as process no 1. +111 diff --git a/src/runsv.check b/src/runsv.check @@ -0,0 +1,45 @@ +#!/bin/sh +rm -rf "${ctmp}" + +runsv +echo $? + +mkdir "${ctmp}" +echo '#!/bin/sh' >"${ctmp}"/run +echo 'echo starting' >>"${ctmp}"/run +echo 'exec sleep 14' >>"${ctmp}"/run +chmod 700 "${ctmp}"/run +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/supervise/stat || sleep 2 +cat "${ctmp}"/supervise/stat +echo x >"${ctmp}"/supervise/control +wait +echo $? + +mkdir "${ctmp}"/log +echo '#!/bin/sh' >"${ctmp}"/log/run +echo 'exec cat >foo' >>"${ctmp}"/log/run +chmod 700 "${ctmp}"/log/run +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/log/supervise/stat || sleep 2 +echo x >"${ctmp}"/supervise/control +wait +echo $? +cat "${ctmp}"/log/foo + +rm -rf "${ctmp}"/supervise +rm -rf "${ctmp}"/log/supervise +rm -f "${ctmp}"/log/foo +ln -s foo "${ctmp}"/supervise +ln -s bar "${ctmp}"/log/supervise +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/supervise/stat || sleep 2 +test -r "${ctmp}"/log/supervise/stat || sleep 2 +echo x >"${ctmp}"/foo/control +wait +echo $? +cat "${ctmp}"/log/foo +rm -rf "${ctmp}" diff --git a/src/runsv.dist b/src/runsv.dist @@ -0,0 +1,10 @@ +usage: runsv dir + +1 +starting +run +0 +0 +starting +0 +starting diff --git a/src/runsvchdir.check b/src/runsvchdir.check @@ -0,0 +1,3 @@ +#!/bin/sh +runsvchdir +echo $? diff --git a/src/runsvchdir.dist b/src/runsvchdir.dist @@ -0,0 +1,3 @@ +usage: runsvchdir dir + +1 diff --git a/src/runsvctrl.check b/src/runsvctrl.check @@ -0,0 +1,23 @@ +#!/bin/sh +rm -rf "${ctmp}" + +runsvctrl +echo $? + +mkdir "${ctmp}" +echo '#!/bin/sh' >"${ctmp}"/run +echo 'echo starting' >>"${ctmp}"/run +echo 'exec sleep 14' >>"${ctmp}"/run +chmod 700 "${ctmp}"/run +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/supervise/stat || sleep 2 +runsvctrl down "${ctmp}" +echo $? +sleep 1 +cat "${ctmp}"/supervise/stat +runsvctrl exit "${ctmp}" +echo $? +wait +echo $? +rm -rf "${ctmp}" diff --git a/src/runsvctrl.dist b/src/runsvctrl.dist @@ -0,0 +1,8 @@ +usage: runsvctrl u|d|o|p|c|h|a|i|1|2|t|k|x|e service ... + +1 +starting +0 +down +0 +0 diff --git a/src/runsvdir.check b/src/runsvdir.check @@ -0,0 +1,3 @@ +#!/bin/sh +runsvdir +echo $? diff --git a/src/runsvdir.dist b/src/runsvdir.dist @@ -0,0 +1,3 @@ +usage: runsvdir dir + +1 diff --git a/src/runsvstat.check b/src/runsvstat.check @@ -0,0 +1,26 @@ +#!/bin/sh +rm -rf "${ctmp}" + +runsvstat +echo $? +runsvstat -V +echo $? + +mkdir "${ctmp}" +echo '#!/bin/sh' >"${ctmp}"/run +echo 'echo starting' >>"${ctmp}"/run +echo 'exec sleep 14' >>"${ctmp}"/run +chmod 700 "${ctmp}"/run +chpst -2 runsvstat "${ctmp}" +echo $? +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/supervise/stat || sleep 2 +chpst -1 runsvstat "${ctmp}" +echo $? +runsvctrl exit "${ctmp}" +wait +echo $? +chpst -2 runsvstat "${ctmp}" +echo $? +rm -rf "${ctmp}" diff --git a/src/runsvstat.dist b/src/runsvstat.dist @@ -0,0 +1,12 @@ +usage: runsvstat [ -l ] service ... + +1 +$Id$ +usage: runsvstat [ -l ] service ... + +1 +1 +starting +0 +0 +1 diff --git a/src/svlogd.check b/src/svlogd.check @@ -0,0 +1,21 @@ +#!/bin/sh +rm -rf "${ctmp}" + +svlogd +echo $? +svlogd -V +echo $? + +mkdir "${ctmp}" +echo foo |svlogd "${ctmp}" +echo $? +cat "${ctmp}"/current + +( echo bar; echo baz ) |svlogd "${ctmp}" +echo $? +cat "${ctmp}"/current + +( echo foo; echo bar; echo baz ) |svlogd -r: -R fb "${ctmp}" +echo $? +cat "${ctmp}"/current +rm -rf "${ctmp}" diff --git a/src/svlogd.dist b/src/svlogd.dist @@ -0,0 +1,20 @@ +usage: svlogd [-tv] [-r c] [-R abc] [-l n ] [-b n] dir ... + +111 +$Id$ +usage: svlogd [-tv] [-r c] [-R abc] [-l n ] [-b n] dir ... + +111 +0 +foo +0 +foo +bar +baz +0 +foo +bar +baz +:oo +:ar +:az diff --git a/src/svwaitdown.check b/src/svwaitdown.check @@ -0,0 +1,24 @@ +#!/bin/sh +rm -rf "${ctmp}" + +svwaitdown +echo $? +svwaitdown -V +echo $? + +mkdir "${ctmp}" +echo '#!/bin/sh' >"${ctmp}"/run +echo 'echo starting' >>"${ctmp}"/run +echo 'exec sleep 14' >>"${ctmp}"/run +chmod 700 "${ctmp}"/run +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/supervise/stat || sleep 2 +svwaitdown "${ctmp}" +echo $? +svwaitdown -x "${ctmp}" +echo $? +cat "${ctmp}"/supervise/stat +wait +echo $? +rm -rf "${ctmp}" diff --git a/src/svwaitdown.dist b/src/svwaitdown.dist @@ -0,0 +1,12 @@ +usage: svwaitdown [-v] [-t 2..6000] service ... + +1 +$Id$ +usage: svwaitdown [-v] [-t 2..6000] service ... + +1 +starting +0 +0 +down +0 diff --git a/src/svwaitup.check b/src/svwaitup.check @@ -0,0 +1,28 @@ +#!/bin/sh +rm -rf "${ctmp}" + +svwaitup +echo $? +svwaitup -V +echo $? + +mkdir "${ctmp}" +echo '#!/bin/sh' >"${ctmp}"/run +echo 'echo starting' >>"${ctmp}"/run +echo 'exec sleep 14' >>"${ctmp}"/run +chmod 700 "${ctmp}"/run +runsv "${ctmp}" & +sleep 1 +test -r "${ctmp}"/supervise/stat || sleep 2 +svwaitup "${ctmp}" +echo $? +cat "${ctmp}"/supervise/stat +svwaitup -s2 "${ctmp}" +echo $? +cat "${ctmp}"/supervise/stat +runsvctrl exit "${ctmp}" +wait +echo $? +chpst -2 svwaitup -s2 "${ctmp}" +echo $? +rm -rf "${ctmp}" diff --git a/src/svwaitup.dist b/src/svwaitup.dist @@ -0,0 +1,14 @@ +usage: svwaitup [-v] [-s 2..600] service ... + +1 +$Id$ +usage: svwaitup [-v] [-s 2..600] service ... + +1 +starting +0 +run +0 +run +0 +1 diff --git a/src/utmpset.check b/src/utmpset.check @@ -0,0 +1,5 @@ +#!/bin/sh +utmpset +echo $? +utmpset -V +echo $? diff --git a/src/utmpset.dist b/src/utmpset.dist @@ -0,0 +1,7 @@ +usage: utmpset [-w] line + +1 +$Id$ +usage: utmpset [-w] line + +1