runit

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

commit 9557e5da11afd6db43f036d90e798d0cbf8416a1
parent cccb4adc2b21377a5199545207060286c27fd954
Author: Gerrit Pape <pape@smarden.org>
Date:   Mon, 13 Dec 2004 19:26:20 +0000

don't update timestamp in status when running ./finish; only sleep for a second
if ./run has been restarted within a second, and after updating status to down,
normally up, want up.

Diffstat:
Mdoc/upgrade.html | 6++++++
Mpackage/CHANGES | 5++++-
Msrc/runsv.c | 24+++++++++++++-----------
3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -16,6 +16,12 @@ controlling the service through commands normally sent by arbitrary actions through external programs can optionally be specified, and signalling of the service disabled if desired. See the <a href="runsv.8.html">man page</a> for details. +<p> +<a href="runsv.8.html">runsv</a> now reports the seconds since <tt>./run</tt> +has been started when running the <tt>./finish</tt> script, instead of the +seconds since <tt>./finish</tt> has been started. +It no longer reports immediately failing <tt>./run</tt> scripts as ``running'' +for up to one second, but as ``down, normally up, want up''. <h3>1.0.x to 1.1.0</h3> The <a href="svlogd.8.html">svlogd</a> program now interprets the ``e'' and ``E'' configuration options so that they can be combined to select or diff --git a/package/CHANGES b/package/CHANGES @@ -2,7 +2,10 @@ runit 1.2.0 Sun, 12 Dec 2004 20:17:29 +0000 * doc/upgrade.html: typo. * runsv.c: support custom control commands through control/ directory, - optionally switch off sending signal. + optionally switch off sending signal; don't update timestamp in status + when running ./finish; only sleep for a second if ./run has been + restarted within a second, and after updating status to down, normally + up, want up. * man/runsv.8: document custom control commands. * runsv.check, runsv.dist: check custom control commands. diff --git a/src/runsv.c b/src/runsv.c @@ -215,19 +215,19 @@ unsigned int custom(struct svdir *s, char c) { if (stat(a, &st) == 0) { if (st.st_mode & S_IXUSR) { if ((pid =fork()) == -1) { - warn("unable to fork for ctrl/?"); - return(0); + warn("unable to fork for ctrl/?"); + return(0); } if (! pid) { - if (haslog && fd_copy(1, logpipe[1]) == -1) - warn("unable to setup stdout for ctrl/?"); - prog[0] =a; - prog[1] =0; - execve(a, prog, environ); + if (haslog && fd_copy(1, logpipe[1]) == -1) + warn("unable to setup stdout for ctrl/?"); + prog[0] =a; + prog[1] =0; + execve(a, prog, environ); } if (wait_pid(&w, pid) == -1) { - warn("unable to wait for child ctrl/?"); - return(0); + warn("unable to wait for child ctrl/?"); + return(0); } return(! wait_exitcode(w)); } @@ -294,7 +294,6 @@ void startservice(struct svdir *s) { pidchanged =1; s->ctrl =C_NOOP; update_status(s); - sleep(1); } int ctrl(struct svdir *s, char c) { switch(c) { @@ -527,7 +526,6 @@ int main(int argc, char **argv) { svd[0].pid =0; pidchanged =1; svd[0].ctrl &=~C_TERM; - taia_now(&svd[0].start); if (svd[0].state != S_FINISH) if ((fd =open_read("finish")) != -1) { close(fd); @@ -536,7 +534,11 @@ int main(int argc, char **argv) { break; } svd[0].state =S_DOWN; + taia_uint(&deadline, 1); + taia_add(&deadline, &svd[0].start, &deadline); + taia_now(&svd[0].start); update_status(&svd[0]); + if (taia_less(&svd[0].start, &deadline)) sleep(1); } if (haslog) { if (child == svd[1].pid) {