* the rest of sysvinit
@ 2004-05-14 21:04 Alejandro Mery
2004-05-14 22:06 ` Gerrit Pape
0 siblings, 1 reply; 8+ messages in thread
From: Alejandro Mery @ 2004-05-14 21:04 UTC (permalink / raw)
hi,
iirc you posted once a shutdown replacement, is it available somewhere?
what about the other common tools provided by sysvinit like wall,
halt/reboot and killall5?
Best regards,
Alejandro Mery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: the rest of sysvinit
2004-05-14 21:04 the rest of sysvinit Alejandro Mery
@ 2004-05-14 22:06 ` Gerrit Pape
2004-05-14 22:24 ` Alejandro Mery
2004-06-20 12:42 ` initiate reboot in stage 1 (Re: the rest of sysvinit) Gerrit Pape
0 siblings, 2 replies; 8+ messages in thread
From: Gerrit Pape @ 2004-05-14 22:06 UTC (permalink / raw)
On Fri, May 14, 2004 at 05:04:55PM -0400, Alejandro Mery wrote:
> iirc you posted once a shutdown replacement, is it available somewhere?
It was a reboot command, but you need this only if you want to tell the
kernel to reboot in stage 1, use with care
http://article.gmane.org/gmane.comp.sysutils.supervision.general/315
> what about the other common tools provided by sysvinit like wall,
> halt/reboot and killall5?
halt is `init 0`, reboot is `init 6`, wall possibly better fits into a
package dealing with login accounting. killall5. Ideally there's a
clean process hierarchy, and after taking down all services, all
processes on the system are terminated. I currently don't know how to
write a cross-platform killall5 that works on all systems runit runs on.
Regards, Gerrit.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: the rest of sysvinit
2004-05-14 22:06 ` Gerrit Pape
@ 2004-05-14 22:24 ` Alejandro Mery
2004-05-14 23:50 ` Charlie Brady
2004-06-20 12:42 ` initiate reboot in stage 1 (Re: the rest of sysvinit) Gerrit Pape
1 sibling, 1 reply; 8+ messages in thread
From: Alejandro Mery @ 2004-05-14 22:24 UTC (permalink / raw)
Cc: supervision
Gerrit Pape wrote:
>On Fri, May 14, 2004 at 05:04:55PM -0400, Alejandro Mery wrote:
>
>
>>iirc you posted once a shutdown replacement, is it available somewhere?
>>
>>
>
>It was a reboot command, but you need this only if you want to tell the
>kernel to reboot in stage 1, use with care
> http://article.gmane.org/gmane.comp.sysutils.supervision.general/315
>
>
>
>>what about the other common tools provided by sysvinit like wall,
>>halt/reboot and killall5?
>>
>>
>
>halt is `init 0`, reboot is `init 6`
>
and shutdown a bash script using them?
>, wall possibly better fits into a
>package dealing with login accounting.
>
i want to finaly remove sysvinit, wall, sulogin, last and mesg fit in
this 'package dealing with login accounting' concept but they are
'needed' and they are on that package i want to drop :p
>killall5. Ideally there's a
>clean process hierarchy, and after taking down all services, all
>processes on the system are terminated.
>
process runing supervised by runsv fit that but there are other
processes runing which diserve a change to terminate properly :-)
>I currently don't know how to
>write a cross-platform killall5 that works on all systems runit runs on.
>
>
you can start with the more common ones *g*
>Regards, Gerrit.
>
>
Thanks,
Alejandro Mery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: the rest of sysvinit
2004-05-14 22:24 ` Alejandro Mery
@ 2004-05-14 23:50 ` Charlie Brady
2004-05-15 0:06 ` Alejandro Mery
0 siblings, 1 reply; 8+ messages in thread
From: Charlie Brady @ 2004-05-14 23:50 UTC (permalink / raw)
Cc: supervision
On Fri, 14 May 2004, Alejandro Mery wrote:
> >killall5. Ideally there's a
> >clean process hierarchy, and after taking down all services, all
> >processes on the system are terminated.
> >
> process runing supervised by runsv fit that but there are other
> processes runing which diserve a change to terminate properly :-)
Presuming that you start these from a supervised run script, then your run
script can trap term, ask all those processes to terminate, wait for them
to do so, then exit.
--
Charlie
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: the rest of sysvinit
2004-05-14 23:50 ` Charlie Brady
@ 2004-05-15 0:06 ` Alejandro Mery
0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Mery @ 2004-05-15 0:06 UTC (permalink / raw)
Charlie Brady wrote:
>On Fri, 14 May 2004, Alejandro Mery wrote:
>
>
>
>>>killall5. Ideally there's a
>>>clean process hierarchy, and after taking down all services, all
>>>processes on the system are terminated.
>>>
>>>
>>>
>>process runing supervised by runsv fit that but there are other
>>processes runing which diserve a change to terminate properly :-)
>>
>>
>
>Presuming that you start these from a supervised run script, then your run
>script can trap term, ask all those processes to terminate, wait for them
>to do so, then exit.
>
getties have started with a run script, then shell and stuff in fg run
by the user will terminate fine (i hope), but bg-ed and friendly
self-daemonizing apps like screen not. orphans neither.
/me wonders about sshd children too.
Regards,
Alejandro Mery
^ permalink raw reply [flat|nested] 8+ messages in thread
* initiate reboot in stage 1 (Re: the rest of sysvinit)
2004-05-14 22:06 ` Gerrit Pape
2004-05-14 22:24 ` Alejandro Mery
@ 2004-06-20 12:42 ` Gerrit Pape
2004-06-22 14:38 ` Alejandro Mery
1 sibling, 1 reply; 8+ messages in thread
From: Gerrit Pape @ 2004-06-20 12:42 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 715 bytes --]
On Fri, May 14, 2004 at 10:06:27PM +0000, Gerrit Pape wrote:
> On Fri, May 14, 2004 at 05:04:55PM -0400, Alejandro Mery wrote:
> > iirc you posted once a shutdown replacement, is it available somewhere?
>
> It was a reboot command, but you need this only if you want to tell the
> kernel to reboot in stage 1, use with care
> http://article.gmane.org/gmane.comp.sysutils.supervision.general/315
Hi, I plan to make the following changes to the runit program, please
see the attached patch. If stage 1 crashes or exits 100, stage 2 will
be skipped; if stage 2 crashes or exits 111, it will be restarted.
This should eliminate the need for such a reboot program, see the
updated runit man page.
Regards, Gerrit.
[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 7894 bytes --]
Index: doc/runit.8.html
===================================================================
RCS file: /var/lib/cvs/runit/doc/runit.8.html,v
retrieving revision 1.16
diff -u -r1.16 runit.8.html
--- doc/runit.8.html 28 Mar 2004 18:31:17 -0000 1.16
+++ doc/runit.8.html 20 Jun 2004 12:08:23 -0000
@@ -15,46 +15,46 @@
<h2><a name='sect2'>Description</a></h2>
<b>runit</b> must be run
as Unix process no 1. It performs the system’s booting, running, and shutdown
-in three Stages:
+in three stages:
<h2><a name='sect3'>Stage 1</a></h2>
<b>runit</b> runs <i>/etc/runit/1</i> and waits for it to terminate.
The system’s one time tasks are done here. <i>/etc/runit/1</i> has full control
of <i>/dev/console</i> to be able to start an emergency shell if the one time
-initialization tasks fail. If <i>/etc/runit/1</i> itself crashes, <b>runit</b> will skip
-stage 2 and enter stage 3.
+initialization tasks fail. If <i>/etc/runit/1</i> crashes, or exits 100, <b>runit</b>
+will skip stage 2 and enter stage 3.
<h2><a name='sect4'>Stage 2</a></h2>
-<b>runit</b> runs <i>/etc/runit/2</i>, which should
-not return until system shutdown; if it crashes, it will be restarted. Normally
-<i>/etc/runit/2</i> starts <i><b>runsvdir</b>(8)</i>. <b>runit</b> is able to handle the ctrl-alt-del
-keyboard request in Stage 2, see below.
+<b>runit</b> runs <i>/etc/runit/2</i>, which
+should not return until system shutdown; if it crashes, or exits 111, it
+will be restarted. Normally <i>/etc/runit/2</i> starts <i><b>runsvdir</b>(8)</i>. <b>runit</b> is able
+to handle the ctrl-alt-del keyboard request in stage 2, see below.
<h2><a name='sect5'>Stage 3</a></h2>
-If <b>runit</b> is told to shutdown
-the system, or the Stage 2 returns without errors, it terminates Stage
-2 if it is running, and runs <i>/etc/runit/3</i>. The systems tasks to shutdown
-and halt or reboot are done here. If Stage 3 returns, <b>runit</b> checks if the
-file <i>/etc/runit/reboot</i> exists and has the execute by owner permission set.
-If so, the system is rebooted, it’s halted otherwise.
+If
+<b>runit</b> is told to shutdown the system, or stage 2 returns, it terminates
+stage 2 if it is running, and runs <i>/etc/runit/3</i>. The systems tasks to shutdown
+and possibly halt or reboot the system are done here. If stage 3 returns,
+<b>runit</b> checks if the file <i>/etc/runit/reboot</i> exists and has the execute by
+owner permission set. If so, the system is rebooted, it’s halted otherwise.
+
<h2><a name='sect6'>Ctrl-alt-del</a></h2>
-If <b>runit</b>
-receives the ctrl-alt-del keyboard request and the file <i>/etc/runit/ctrlaltdel</i>
-exists and has the execute by owner permission set, <b>runit</b> runs <i>/etc/runit/ctrlaltdel</i>,
-waits for it to terminate, and then sends itself a CONT signal.
+If <b>runit</b> receives the ctrl-alt-del keyboard request and the file
+<i>/etc/runit/ctrlaltdel</i> exists and has the execute by owner permission set,
+<b>runit</b> runs <i>/etc/runit/ctrlaltdel</i>, waits for it to terminate, and then sends
+itself a CONT signal.
<h2><a name='sect7'>Signals</a></h2>
-<b>runit</b>
-only accepts signals in Stage 2. <p>
-If <b>runit</b> receives a CONT signal and the
-file <i>/etc/runit/stopit</i> exists and has the execute by owner permission set,
-<b>runit</b> is told to shutdown the system. <p>
-if <b>runit</b> receives an INT signal, a
-ctrl-alt-del keyboard request is triggered.
+<b>runit</b> only accepts signals in stage 2. <p>
+If <b>runit</b>
+receives a CONT signal and the file <i>/etc/runit/stopit</i> exists and has the
+execute by owner permission set, <b>runit</b> is told to shutdown the system. <p>
+if
+<b>runit</b> receives an INT signal, a ctrl-alt-del keyboard request is triggered.
+
<h2><a name='sect8'>See Also</a></h2>
-<i>runit-init(8)</i>, <i>runsvdir(8)</i>,
-<i>runsvchdir(8)</i>, <i>utmpset(8)</i>, <i>runsv(8)</i>, <i>runsvctrl(8)</i>, <i>runsvstat(8)</i>, <i>chpst(8)</i>,
-<i>svlogd(8)</i>, <i>svwaitdown(8)</i>, <i>svwaitup(8)</i> <p>
+<i>runit-init(8)</i>, <i>runsvdir(8)</i>, <i>runsvchdir(8)</i>, <i>utmpset(8)</i>, <i>runsv(8)</i>,
+<i>runsvctrl(8)</i>, <i>runsvstat(8)</i>, <i>chpst(8)</i>, <i>svlogd(8)</i>, <i>svwaitdown(8)</i>, <i>svwaitup(8)</i>
+<p>
<i>http://smarden.org/runit/</i>
<h2><a name='sect9'>Author</a></h2>
-Gerrit
-Pape <pape@smarden.org> <p>
+Gerrit Pape <pape@smarden.org> <p>
<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
Index: man/runit.8
===================================================================
RCS file: /var/lib/cvs/runit/man/runit.8,v
retrieving revision 1.13
diff -u -r1.13 runit.8
--- man/runit.8 28 Mar 2004 18:17:13 -0000 1.13
+++ man/runit.8 20 Jun 2004 12:08:25 -0000
@@ -6,7 +6,7 @@
.SH DESCRIPTION
.B runit
must be run as Unix process no 1.
-It performs the system's booting, running, and shutdown in three Stages:
+It performs the system's booting, running, and shutdown in three stages:
.SH STAGE 1
.B runit
runs
@@ -19,29 +19,30 @@
to be able to start an emergency shell if the one time initialization tasks
fail. If
.I /etc/runit/1
-itself crashes,
+crashes, or exits 100,
.B runit
will skip stage 2 and enter stage 3.
.SH STAGE 2
.B runit
runs
.IR /etc/runit/2 ,
-which should not return until system shutdown; if it crashes, it will be
-restarted.
+which should not return until system shutdown; if it crashes, or exits 111,
+it will be restarted.
Normally
.I /etc/runit/2
starts
.BR runsvdir (8).
.B runit
-is able to handle the ctrl-alt-del keyboard request in Stage 2, see below.
+is able to handle the ctrl-alt-del keyboard request in stage 2, see below.
.SH STAGE 3
If
.B runit
-is told to shutdown the system, or the Stage 2 returns without errors, it
-terminates Stage 2 if it is running, and runs
+is told to shutdown the system, or stage 2 returns, it terminates stage 2 if
+it is running, and runs
.IR /etc/runit/3 .
-The systems tasks to shutdown and halt or reboot are done here.
-If Stage 3 returns,
+The systems tasks to shutdown and possibly halt or reboot the system are
+done here.
+If stage 3 returns,
.B runit
checks if the file
.I /etc/runit/reboot
@@ -59,7 +60,7 @@
waits for it to terminate, and then sends itself a CONT signal.
.SH SIGNALS
.B runit
-only accepts signals in Stage 2.
+only accepts signals in stage 2.
.P
If
.B runit
Index: src/runit.c
===================================================================
RCS file: /var/lib/cvs/runit/src/runit.c,v
retrieving revision 1.11
diff -u -r1.11 runit.c
--- src/runit.c 28 Oct 2003 12:06:22 -0000 1.11
+++ src/runit.c 20 Jun 2004 12:08:26 -0000
@@ -168,27 +168,28 @@
if (child == pid) {
if (wait_exitcode(wstat) != 0) {
- if (wait_crashed(wstat)) {
+ if (wait_crashed(wstat))
strerr_warn3(WARNING, "child crashed: ", stage[st], 0);
- if (st == 0) {
- /* this is stage 1 */
+ else
+ strerr_warn3(WARNING, "child failed: ", stage[st], 0);
+ if (st == 0)
+ /* this is stage 1 */
+ if (wait_crashed(wstat) || (wait_exitcode(wstat) == 100)) {
strerr_warn3(INFO, "leave stage: ", stage[st], 0);
strerr_warn2(WARNING, "skipping stage 2...", 0);
st++;
break;
}
- }
- else
- strerr_warn3(WARNING, "child failed: ", stage[st], 0);
- if (st == 1) {
+ if (st == 1)
/* this is stage 2 */
- strerr_warn2(WARNING, "killing all processes in stage 2...", 0);
- kill(-pid, 9);
- sleep(5);
- strerr_warn2(WARNING, "restarting.", 0);
- st--;
- break;
- }
+ if (wait_crashed(wstat) || (wait_exitcode(wstat) == 111)) {
+ strerr_warn2(WARNING, "killing all processes in stage 2...", 0);
+ kill(-pid, 9);
+ sleep(5);
+ strerr_warn2(WARNING, "restarting.", 0);
+ st--;
+ break;
+ }
}
strerr_warn3(INFO, "leave stage: ", stage[st], 0);
break;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: initiate reboot in stage 1 (Re: the rest of sysvinit)
2004-06-20 12:42 ` initiate reboot in stage 1 (Re: the rest of sysvinit) Gerrit Pape
@ 2004-06-22 14:38 ` Alejandro Mery
2004-06-22 22:09 ` Alejandro Mery
0 siblings, 1 reply; 8+ messages in thread
From: Alejandro Mery @ 2004-06-22 14:38 UTC (permalink / raw)
Cc: supervision
Gerrit Pape wrote:
>On Fri, May 14, 2004 at 10:06:27PM +0000, Gerrit Pape wrote:
>
>
>>On Fri, May 14, 2004 at 05:04:55PM -0400, Alejandro Mery wrote:
>>
>>
>>>iirc you posted once a shutdown replacement, is it available somewhere?
>>>
>>>
>>It was a reboot command, but you need this only if you want to tell the
>>kernel to reboot in stage 1, use with care
>> http://article.gmane.org/gmane.comp.sysutils.supervision.general/315
>>
>>
>
>Hi, I plan to make the following changes to the runit program, please
>see the attached patch. If stage 1 crashes or exits 100, stage 2 will
>be skipped; if stage 2 crashes or exits 111, it will be restarted.
>
>This should eliminate the need for such a reboot program, see the
>updated runit man page.
>
sounds food :-)
Alejandro Mery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: initiate reboot in stage 1 (Re: the rest of sysvinit)
2004-06-22 14:38 ` Alejandro Mery
@ 2004-06-22 22:09 ` Alejandro Mery
0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Mery @ 2004-06-22 22:09 UTC (permalink / raw)
Alejandro Mery wrote:
> Gerrit Pape wrote:
>
>> On Fri, May 14, 2004 at 10:06:27PM +0000, Gerrit Pape wrote:
>>
>>
>>> On Fri, May 14, 2004 at 05:04:55PM -0400, Alejandro Mery wrote:
>>>
>>>
>>>> iirc you posted once a shutdown replacement, is it available
>>>> somewhere?
>>>>
>>>
>>> It was a reboot command, but you need this only if you want to tell the
>>> kernel to reboot in stage 1, use with care
>>> http://article.gmane.org/gmane.comp.sysutils.supervision.general/315
>>>
>>
>>
>> Hi, I plan to make the following changes to the runit program, please
>> see the attached patch. If stage 1 crashes or exits 100, stage 2 will
>> be skipped; if stage 2 crashes or exits 111, it will be restarted.
>>
>> This should eliminate the need for such a reboot program, see the
>> updated runit man page.
>>
> sounds food :-)
s/food/good/g :'(
Alejandro Mery
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-06-22 22:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 21:04 the rest of sysvinit Alejandro Mery
2004-05-14 22:06 ` Gerrit Pape
2004-05-14 22:24 ` Alejandro Mery
2004-05-14 23:50 ` Charlie Brady
2004-05-15 0:06 ` Alejandro Mery
2004-06-20 12:42 ` initiate reboot in stage 1 (Re: the rest of sysvinit) Gerrit Pape
2004-06-22 14:38 ` Alejandro Mery
2004-06-22 22:09 ` Alejandro Mery
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).