supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
Subject: Re: runit-1.0.0 release
Date: Thu, 12 Feb 2004 20:46:20 +0000	[thread overview]
Message-ID: <20040212204520.26049.qmail@c032e53e4f6f05.315fe32.mid.smarden.org> (raw)
In-Reply-To: <20040212174120.26bcb697@rad1.109bean.org.uk>

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

On Thu, Feb 12, 2004 at 05:41:20PM +0000, Richard A Downing FBCS wrote:
> I have made progress and now run a standard shell in the recovery
> situation, modelling my script on the openbsd example.  I would have
> liked to use sulogin, which is more secure, but as I was planning not
> to install sysVinit, and sulogin is part of that package, it's out for
> the moment, but see below.

Yes, you're right, sulogin is part of sysvinit.

> I'm beginning to think that I'm going to have to install SysVinit
> after all.  (I may need wall, halt, poweroff, reboot, shutdown, and
> sulogin, these are all part of sysVinit)

I still have the sysvinit package on my systems, and use some of its
tools.  It's very difficult to remove the 'essential' package sysvinit
from a Debian system, even if runit is used as init scheme, because
other essential packages depend on sysvinit directly (e.g. dpkg).

A halt and reboot program actually is very simple; but beware, it simply
reboots or halts the kernel and doesn't care about the system's state.
If you use it from stage 1, you should exactly know the system's state
as /etc/runit/1 is the first and only process started since process no 1.

I attach a sample 'reboot.c' source file.  Put it into
/package/admin/runit/compile/, change to this directory, add this to
the Makefile, and run make reboot:
 # cat >>Makefile <<EOT
 reboot: load reboot.o unix.a byte.a
      ./load reboot unix.a byte.a -static
 reboot.o: compile reboot.c reboot_system.h
      ./compile reboot.c
 EOT
 # make reboot

This gives you a reboot program, and with a minor change a halt program.

Regards, Gerrit.

[-- Attachment #2: reboot.c --]
[-- Type: text/plain, Size: 643 bytes --]

#include <unistd.h>
#include "reboot_system.h"
#include "strerr.h"

#ifndef RB_AUTOBOOT
#error "RB_AUTOBOOT undefined"
#endif

unsigned int doreboot =1;  /* set to 0 for halt */
int r =0;

int main(int argc, char **argv) {
  sync();
  if (doreboot)
    r =reboot_system(RB_AUTOBOOT);
  else {
#ifdef RB_POWER_OFF
    r =reboot_system(RB_POWER_OFF);
    if (r) strerr_die2sys(100, *argv, ": fatal: ");
#endif
#ifdef RB_HALT_SYSTEM
    r =reboot_system(RB_HALT_SYSTEM);
#else
#ifdef RB_HALT
    r =reboot_system(RB_HALT);
#else
    r =reboot_system(RB_AUTOBOOT);
#endif
#endif
  }
  if (r) strerr_die2sys(100, *argv, ": fatal: ");
  _exit(0);
}

  reply	other threads:[~2004-02-12 20:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-10 15:35 Gerrit Pape
2004-02-11  8:35 ` Lukas Beeler
2004-02-11 17:37   ` Gerrit Pape
2004-02-11 19:23 ` Richard A Downing FBCS
2004-02-11 20:43   ` Gerrit Pape
2004-02-12 17:41     ` Richard A Downing FBCS
2004-02-12 20:46       ` Gerrit Pape [this message]
2004-02-12 21:15         ` Alejandro Mery
2004-02-13  2:13           ` nullmailer & fghack? (was Re: runit-1.0.0 release) Charlie Brady
2004-02-13  2:32             ` Alejandro Mery
2004-02-13 15:29               ` Charlie Brady
2004-02-13 16:32                 ` Alejandro Mery
2004-02-14 12:22           ` runit-1.0.0 release Gerrit Pape
2004-02-16 22:04             ` Alejandro Mery
2004-02-19 16:15               ` Gerrit Pape
2004-02-19 21:03                 ` Stefan Karrmann
2004-02-11 22:05   ` Thomas Schwinge
2004-03-08 19:22 ` runit-1.0.1 release Gerrit Pape
2004-03-30 19:08   ` runit-1.0.2 release Gerrit Pape
2004-06-28  7:55     ` runit-1.0.3 release Gerrit Pape
2004-08-02 16:43       ` runit-1.0.4 release Gerrit Pape
2004-09-22 20:44         ` runit-1.0.5 release Gerrit Pape

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040212204520.26049.qmail@c032e53e4f6f05.315fe32.mid.smarden.org \
    --to=pape@smarden.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).