summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/chpst.8.html14
-rw-r--r--doc/runsv.8.html20
-rw-r--r--man/chpst.818
-rw-r--r--man/runsv.837
-rw-r--r--src/chpst.c2
-rw-r--r--src/chpst.dist4
6 files changed, 77 insertions, 18 deletions
diff --git a/doc/chpst.8.html b/doc/chpst.8.html
index 97d90f2..c481ce2 100644
--- a/doc/chpst.8.html
+++ b/doc/chpst.8.html
@@ -11,9 +11,9 @@
 <h2><a name='sect0'>Name</a></h2>
 chpst - runs a program with a changed process state 
 <h2><a name='sect1'>Synopsis</a></h2>
-<b>chpst</b> [-vP012]
+<b>chpst</b> [-vVP012]
 [-u <i>user</i>] [-U <i>user</i>] [-b <i>argv0</i>] [-e <i>dir</i>] [-/ <i>root</i>] [-n <i>inc</i>] [-l|-L <i>lock</i>] [-m <i>bytes</i>] [-d <i>bytes</i>]
-[-o <i>n</i>] [-p <i>n</i>] [-f <i>bytes</i>] [-c <i>bytes</i>] <i>prog</i> 
+[-o <i>n</i>] [-p <i>n</i>] [-f <i>bytes</i>] [-c <i>bytes</i>] [-t <i>seconds</i>] <i>prog</i>
 <h2><a name='sect2'>Description</a></h2>
 <i>prog</i> consists of one or
 more arguments. <p>
@@ -30,7 +30,7 @@ and a <i>group</i>, set the gid to <i>group</i>&rsquo;s gid, as found in <i>/etc
 of <i>user</i>&rsquo;s gid. If <i>group</i> consists of a colon-separated list of group names,
 <b>chpst</b> sets the group ids of all listed groups. If <i>user</i> is prefixed with
 a colon, the <i>user</i> and all <i>group</i> arguments are interpreted as uid and gids
-respectivly, and not looked up in the password or group file. All initial
+respectively, and not looked up in the password or group file. All initial
 supplementary groups are removed. </dd>
 
 <dt><b>-U <i>[:]user[:group]</b> </i></dt>
@@ -38,7 +38,7 @@ supplementary groups are removed. </dd>
 variables $UID and $GID to the <i>user</i>&rsquo;s uid and gid, as found in <i>/etc/passwd</i>.
 If <i>user</i> is followed by a colon and a <i>group</i>, set $GID to the <i>group</i>&rsquo;s gid,
 as found in <i>/etc/group</i>, instead of <i>user</i>&rsquo;s gid. If <i>user</i> is prefixed with a
-colon, the <i>user</i> and <i>group</i> arguments are interpreted as uid and gid respectivly,
+colon, the <i>user</i> and <i>group</i> arguments are interpreted as uid and gid respectively,
 and not looked up in the password or group file. </dd>
 
 <dt><b>-b <i>argv0</b> </i></dt>
@@ -98,10 +98,16 @@ the output file size to <i>bytes</i> bytes. </dd>
 <dd>limit core size. Limit the core
 file size to <i>bytes</i> bytes. </dd>
 
+<dt><b>-t <i>seconds</b> </i></dt>
+<dd>limit CPU time. Limit CPU time to <i>seconds</i> seconds, delivering a SIGXCPU thereafter.</dd>
+
 <dt><b>-v</b> </dt>
 <dd>verbose. Print verbose messages to standard error.
 This includes warnings about limits unsupported by the system. </dd>
 
+<dt><b>-V</b> </dt>
+<dd>version string. Print a version string to standard error. </dd>
+
 <dt><b>-P</b> </dt>
 <dd>pgrphack.
 Run <i>prog</i> in a new process group. </dd>
diff --git a/doc/runsv.8.html b/doc/runsv.8.html
index d27deeb..04f299e 100644
--- a/doc/runsv.8.html
+++ b/doc/runsv.8.html
@@ -115,15 +115,29 @@ to send a TERM signal to the socklog-unix service, either do   # sv term
 <i><b>printf</b>(1)</i> usually blocks if no <b>runsv</b> process is running in the service
 directory. 
 <h2><a name='sect4'>Customize Control</a></h2>
-For each control character <i>c</i> sent to the control
+For each control character <i>c</i> except "d" and "x" sent to the control
 pipe, <b>runsv</b> first checks if <i>service</i>/control/<i>c</i> exists and is executable.
 If so, it starts <i>service</i>/control/<i>c</i> and waits for it to terminate, before
 interpreting the command. If the program exits with return code 0, <b>runsv</b>
 refrains from sending the service the corresponding signal. The command
 <i>o</i> is always considered as command <i>u</i>. On command <i>d</i> first <i>service</i>/control/<i>t</i>
 is checked, and then <i>service</i>/control/<i>d</i>. On command <i>x</i> first <i>service</i>/control/<i>t</i>
-is checked, and then <i>service</i>/control/<i>x</i>. The control of the optional log
-service cannot be customized. 
+is checked, and then <i>service</i>/control/<i>x</i>. Specifically:<br>
+<p>
+<dt><b>1.</b> </dt>
+<dd><b>runsv</b> checks whether <i>service</i>/control/<i>t</i> exists and is executable and runs it if yes.</dd>
+
+<dt><b>2.</b> </dt>
+<dd>If <i>service</i>/control/<i>t</i> exits nonzero, or is not executable or doesn't exist, <b>runsv</b> sends
+              the service a TERM signal.</dd>
+
+<dt><b>3.</b> </dt>
+<dd><b>runsv</b> sends the service a CONT signal, disregarding <i>service</i>/control/<i>c</i> even if it exists and is executable.</dd>
+
+<dt><b>4.</b> </dt>
+<dd><b>runsv</b> checks whether <i>service</i>/control/<i>d</i> (or control/<i>x</i>) exists and is executable and runs it if yes. Its exit status is ignored.</dd>
+<p>
+The control of the optional log service cannot be customized.
 <h2><a name='sect5'>Signals</a></h2>
 If <b>runsv</b> receives a TERM signal, it
 acts as if the character x was written to the control pipe. 
diff --git a/man/chpst.8 b/man/chpst.8
index 43c0b8d..26c1a1d 100644
--- a/man/chpst.8
+++ b/man/chpst.8
@@ -3,7 +3,7 @@
 chpst \- runs a program with a changed process state
 .SH SYNOPSIS
 .B chpst
-[\-vP012]
+[\-vVP012]
 [\-u
 .IR user ]
 [\-U
@@ -30,6 +30,8 @@ chpst \- runs a program with a changed process state
 .IR bytes ]
 [-c
 .IR bytes ]
+[-t
+.IR seconds ]
 .I prog
 .SH DESCRIPTION
 .I prog
@@ -68,7 +70,7 @@ is prefixed with a colon, the
 .I user
 and all
 .I group
-arguments are interpreted as uid and gids respectivly, and not looked up in
+arguments are interpreted as uid and gids respectively, and not looked up in
 the password or group file.
 All initial supplementary groups are removed.
 .TP
@@ -95,7 +97,7 @@ is prefixed with a colon, the
 .I user
 and
 .I group
-arguments are interpreted as uid and gid respectivly, and not looked up in
+arguments are interpreted as uid and gid respectively, and not looked up in
 the password or group file.
 .TP
 .B \-b \fIargv0
@@ -208,11 +210,21 @@ Limit the core file size to
 .I bytes
 bytes.
 .TP
+.B \-t \fIseconds
+limit CPU time.
+Limit CPU time to
+.I seconds
+seconds, delivering a SIGXCPU thereafter.
+.TP
 .B \-v
 verbose.
 Print verbose messages to standard error.
 This includes warnings about limits unsupported by the system.
 .TP
+.B \-V
+version string.
+Print a version string to standard error.
+.TP
 .B \-P
 pgrphack.
 Run
diff --git a/man/runsv.8 b/man/runsv.8
index 7c5abfc..43ab396 100644
--- a/man/runsv.8
+++ b/man/runsv.8
@@ -54,10 +54,8 @@ and
 .IR service /finish's
 standard output to the pipe, switches to the directory
 .IR service /log
-and starts ./run (and ./finish) exactly as described above for the
-.I service
-directory.
-The standard input of the log service is redirected to read from the pipe.
+and starts ./run script. The standard input of the log service
+is redirected to read from the pipe.
 .P
 .B runsv
 maintains status information in a binary format (compatible to the
@@ -168,7 +166,7 @@ process is running in the service directory.
 .SH CUSTOMIZE CONTROL
 For each control character
 .I c
-sent to the control pipe,
+except "d" and "x" sent to the control pipe,
 .B runsv
 first checks if
 .I service\fR/control/\fIc
@@ -195,6 +193,35 @@ first
 .I service\fR/control/t
 is checked, and then
 .I service\fR/control/x.
+Specifically:
+.P
+If the service is running or paused, control characters "d" and "x" are handled as follows:
+.TP
+.B 1.
+.B runsv
+checks whether
+.I service\fR/control/t
+exists and is executable and runs it if yes.
+.TP
+.B 2.
+If
+.I service\fR/control/t
+exits nonzero, or is not executable or doesn't exist,
+.B runsv
+sends the service a TERM signal.
+.TP
+.B 3.
+.B runsv
+sends the service a CONT signal, disregarding
+.I service\fR/control/c
+even if it exists and is executable.
+.TP
+.B 4.
+.B runsv
+checks whether
+.I service\fR/control/d (or control/x)
+exists and is executable and runs it if yes. Its exit status is ignored.
+.P
 The control of the optional log service cannot be customized.
 .SH SIGNALS
 If
diff --git a/src/chpst.c b/src/chpst.c
index cb4e7a9..86032bc 100644
--- a/src/chpst.c
+++ b/src/chpst.c
@@ -20,7 +20,7 @@
 #include "openreadclose.h"
 #include "direntry.h"
 
-#define USAGE_MAIN " [-vP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] prog"
+#define USAGE_MAIN " [-vVP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] [-t n] prog"
 #define FATAL "chpst: fatal: "
 #define WARNING "chpst: warning: "
 
diff --git a/src/chpst.dist b/src/chpst.dist
index 6779bfd..606264c 100644
--- a/src/chpst.dist
+++ b/src/chpst.dist
@@ -1,8 +1,8 @@
-usage: chpst [-vP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] prog
+usage: chpst [-vVP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] [-t n] prog
 
 100
 $Id: f279d44141c981dd7535a12260efcf1ef7beed26 $
-usage: chpst [-vP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] prog
+usage: chpst [-vVP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] [-t n] prog
 
 100
 test=1