supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Confused about use of finish
@ 2004-03-21 15:23 oss-packages
  2004-03-21 18:07 ` Gerrit Pape
  0 siblings, 1 reply; 2+ messages in thread
From: oss-packages @ 2004-03-21 15:23 UTC (permalink / raw)


Hi,

I don't quite understand the intended purpose of the finish scripts.
In my experience using runit 1.0.1 under GNU/Linux, finish is not called
when runsv receives the exit command. There is an inconsistency in my
view between the 'down' behavior and the 'exit' behavior: in the former
case, finish is executed, in the latter it is not.

At system shutdown, I'd expect that the finish scripts should be executed
to clean up everything, but since shutdown sends the exit command to
runsv, this doesn't happen. I shut down by running init 0 or init 6.

Looking at the runsv code, I'm even more puzzled: when runsv receives the
exit command, it checks for the presence of finish, and sets the status
to 'finish, want exit', but it doesn't actually run finish. Basically
it seems there is no difference whether finish exists or not, except if
it doesn't exist, the status is set to 'down, want exit'.

In the sample scripts for stage 3, svwaitdown is used to perform a last
chance orderly shutdown of the services. svwaitdown is supposed to send
the down command, so finish should be executed then. But typically all my
services have already terminated by the time svwaitdown runs in stage 3,
so it doesn't do anything.

I'd appreciate hearing your comments and clarifications about this.
Thanks,
X.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Confused about use of finish
  2004-03-21 15:23 Confused about use of finish oss-packages
@ 2004-03-21 18:07 ` Gerrit Pape
  0 siblings, 0 replies; 2+ messages in thread
From: Gerrit Pape @ 2004-03-21 18:07 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

On Sun, Mar 21, 2004 at 03:23:14PM -0000, oss-packages@xavier.stonestreet.name wrote:
> In my experience using runit 1.0.1 under GNU/Linux, finish is not called
> when runsv receives the exit command. There is an inconsistency in my
> view between the 'down' behavior and the 'exit' behavior: in the former
> case, finish is executed, in the latter it is not.

> I'd appreciate hearing your comments and clarifications about this.

I share your view, and say it's a bug.  runsv should run the ./finish
script when told to bring the service down and exit, it will be fixed in
1.0.2.

Thanks for reporting this, Gerrit.

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 584 bytes --]

Index: src/runsv.c
===================================================================
RCS file: /var/lib/cvs/runit/src/runsv.c,v
retrieving revision 1.16
diff -u -r1.16 runsv.c
--- src/runsv.c	2 Mar 2004 20:42:56 -0000	1.16
+++ src/runsv.c	21 Mar 2004 18:05:22 -0000
@@ -512,7 +512,7 @@
     if (haslog)
       if (read(svd[1].fdcontrol, &ch, 1) == 1) ctrl(&svd[1], ch);
 
-    if (svd[0].want == W_EXIT && svd[0].pid == 0) {
+    if (svd[0].want == W_EXIT && svd[0].state == S_DOWN) {
       if (svd[1].pid == 0) _exit(0);
       if (svd[1].want != W_EXIT) {
 	svd[1].want =W_EXIT;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-21 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-21 15:23 Confused about use of finish oss-packages
2004-03-21 18:07 ` Gerrit Pape

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).