runit

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

commit 06e4a8368e21419bbed36d7081cebcbbfe554c31
parent 00c444127ece1897aaba4ad77b40fe46846c14b5
Author: Gerrit Pape <pape@smarden.org>
Date:   Mon,  2 Jan 2006 20:38:10 +0000

  * chpst.c: adjust nice value and set limits before dropping permissions.
  * sv.c: new additional command 'check'; with -v check for CONT through
    ./check if service is up.
  * man/sv.8: adapt.
1.3.3.

Diffstat:
MMakefile | 2+-
Mdoc/install.html | 12++++++------
Mdoc/replaceinit.html | 4++--
Mdoc/upgrade.html | 2+-
Mman/sv.8 | 23++++++++++++++++++++---
Mpackage/CHANGES | 7+++++++
Mpackage/upgrade | 4++--
Mpackage/versions | 1+
Msrc/chpst.c | 11+++++------
Msrc/sv.c | 7+++++--
10 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,6 +1,6 @@ DESTDIR= -PACKAGE=runit-1.3.2 +PACKAGE=runit-1.3.3 DIRS=doc man etc package src MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 sv.8 svwaitdown.8 svwaitup.8 \ utmpset.8 runsvchdir.8 runsvstat.8 runsvctrl.8 svlogd.8 chpst.8 diff --git a/doc/install.html b/doc/install.html @@ -17,14 +17,14 @@ If you don't have a <tt>/package</tt> directory, create it now: # chmod 1755 /package </pre> Download -<a href="runit-1.3.2.tar.gz">runit-1.3.2.tar.gz</a> into <tt>/package</tt> +<a href="runit-1.3.3.tar.gz">runit-1.3.3.tar.gz</a> into <tt>/package</tt> and unpack the archive <pre> # cd /package - # gunzip runit-1.3.2.tar - # tar -xpf runit-1.3.2.tar - # rm runit-1.3.2.tar - # cd admin/runit-1.3.2 + # gunzip runit-1.3.3.tar + # tar -xpf runit-1.3.3.tar + # rm runit-1.3.3.tar + # cd admin/runit-1.3.3 </pre> On MacOSX, do <pre> @@ -43,7 +43,7 @@ hierarchy, do: </pre> To report success: <pre> - # mail pape-runit-1.3.2@smarden.org &lt;compile/sysdeps + # mail pape-runit-1.3.3@smarden.org &lt;compile/sysdeps </pre> If you use <i>runit</i> regularly, please <a href="http://smarden.org/pape/#contribution">contribute</a> to the project. diff --git a/doc/replaceinit.html b/doc/replaceinit.html @@ -116,7 +116,7 @@ default Unix process no 1 <i>runit</i>. </pre> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-1.3.2@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-1.3.3@smarden.org </pre> <hr> @@ -205,7 +205,7 @@ This will cause <i>runit</i> to enter stage 3 which runs <p> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-1.3.2@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-1.3.3@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/upgrade.html b/doc/upgrade.html @@ -9,7 +9,7 @@ <hr> <h1>runit - upgrading from previous versions</h1> <hr> -<h3>1.2.x to 1.3.0 or 1.3.1 or 1.3.2</h3> +<h3>1.2.x to 1.3.x</h3> This release introduces a first test version of the <a href="sv.8.html">sv</a> program, which can be used to control the state and query the status of services monitored by <a href="runsv.8.html">runsv</a>. diff --git a/man/sv.8 b/man/sv.8 @@ -49,7 +49,8 @@ to be controlled then is specified by the base name of the ``init script''. .SH COMMANDS .TP .B status -Report the current status of the service to standard output. +Report the current status of the service, and the appendant log service if +available, to standard output. .TP .B up If the service is not running, start it. @@ -181,13 +182,29 @@ process to terminate. Then report the status, and on timeout send the service the .I kill command. +.SH Additional Commands +.TP +.B check +Check for the service to be in the state that's been requested. +Wait up to 7 seconds for the service to reach the requested state, then +report the status or timeout. +If the requested state of the service is +.IR up , +and the script +.I ./check +exists in the service directory, +.B sv +runs this script to check whether the service is up and running; it's +considered to be up if +.I ./check +exits with 0. .SH OPTIONS .TP .B \-v If the .I command -is up, down, term, once, or exit, then wait up to 7 seconds for the command -to take effect. +is up, down, term, once, cont, or exit, then wait up to 7 seconds for the +command to take effect. Then report the status or timeout. .TP .B \-w \fIsec diff --git a/package/CHANGES b/package/CHANGES @@ -1,3 +1,10 @@ +runit 1.3.3 +Mon, 02 Jan 2006 20:35:34 +0000 + * chpst.c: adjust nice value and set limits before dropping permissions. + * sv.c: new additional command 'check'; with -v check for CONT through + ./check if service is up. + * man/sv.8: adapt. + runit 1.3.2 Sun, 18 Dec 2005 11:22:04 +0000 * svlogd.c: don't print extra newlines to the log if additionally writing diff --git a/package/upgrade b/package/upgrade @@ -8,9 +8,9 @@ test -d src || sh -cx '! : Wrong working directory.' here=`env - PATH=$PATH pwd` parent=`dirname $here` -echo 'Creating symlink runit -> runit-1.3.2...' +echo 'Creating symlink runit -> runit-1.3.3...' rm -f runit -ln -s runit-1.3.2 runit +ln -s runit-1.3.3 runit mv -f runit .. echo 'Making command links in /command...' diff --git a/package/versions b/package/versions @@ -37,3 +37,4 @@ 1.3.0 1.3.1 1.3.2 +1.3.3 diff --git a/src/chpst.c b/src/chpst.c @@ -322,18 +322,17 @@ int main(int argc, const char *const *argv) { if (chdir(root) == -1) fatal2("unable to change directory", root); if (chroot(".") == -1) fatal("unable to change root directory"); } + slimit(); + if (nicelvl) { + errno =0; + if (nice(nicelvl) == -1) if (errno) fatal("unable to set nice level"); + } if (env_user) euidgid(env_user, 1); if (set_user) suidgid(set_user, 1); - slimit(); if (lock) slock(lock, lockdelay, 0); if (nostdin) if (close(0) == -1) fatal("unable to close stdin"); if (nostdout) if (close(1) == -1) fatal("unable to close stdout"); if (nostderr) if (close(2) == -1) fatal("unable to close stderr"); - if (nicelvl) { - errno =0; - if (nice(nicelvl) == -1) - if (errno) fatal("unable to set nice level"); - } pathexec(argv); fatal2("unable to run", *argv); return(0); diff --git a/src/sv.c b/src/sv.c @@ -217,6 +217,7 @@ int check(char *a) { case 'x': return(0); case 'u': if (!pid) return(0); if (!checkscript()) return(0); break; case 'd': if (pid) return(0); break; + case 'c': if (pid) if (!checkscript()) return(0); break; case 't': if (!pid && svstatus[17] == 'd') break; tai_unpack(svstatus, &tstatus); @@ -292,7 +293,9 @@ int main(int argc, char **argv) { acts ="d"; kll =1; cbk =&check; break; case 'T': acts ="tc"; kll =1; cbk =&check; break; - case 'u': case 'd': case 'o': case 't': case 'p': case 'c': case 'h': + case 'c': + if (!str_diff(action, "check")) { act =0; acts ="c"; cbk =&check; break; } + case 'u': case 'd': case 'o': case 't': case 'p': case 'h': case 'a': case 'i': case 'k': case 'q': case '1': case '2': action[1] =0; acts =action; break; case 's': @@ -330,7 +333,7 @@ int main(int argc, char **argv) { fail("unable to change to service directory"); *service =0; } - if (*service) if (act(acts) == -1) *service =0; + if (*service) if (act && (act(acts) == -1)) *service =0; if (fchdir(curdir) == -1) fatal("unable to change to original directory"); service++; }