From c2c14b525080203561d9e47d8a10442828342251 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 13 Jan 2018 14:33:25 +0000 Subject: Autogenerate final shutdown; rename rc.tini to rc.shutdown --- doc/quickstart.html | 69 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 10 deletions(-) (limited to 'doc/quickstart.html') diff --git a/doc/quickstart.html b/doc/quickstart.html index 619fbbd..6a0069b 100644 --- a/doc/quickstart.html +++ b/doc/quickstart.html @@ -29,17 +29,13 @@
  • s6-linux-utils
  • s6
  • -
  • Install s6-linux-init itself
  • -
  • Save your old /sbin/init binary
  • -
  • Save and remove your old /etc/s6-linux-init directory, if you have one
  • -
  • Make sure you have a /run directory
  • +
  • Install s6-linux-init itself.
  • +
  • Save your old /sbin/init binary.
  • +
  • Save and remove your old /etc/s6-linux-init directory, if you have one.
  • +
  • Make sure you have a /run directory.
  • Write a machine initialization script in /etc/rc.init and - a machine shutdown script in /etc/rc.shutdown. Make them executable.
  • -
  • If, at shutdown time, you need to run a script before the -supervision tree is torn down (for instance if you're using -s6-rc and want to -cleanly stop all your services), write that script in -/etc/rc.tini.
  • +a machine shutdown script in /etc/rc.shutdown. Make sure they are +executable. See below for more information on how to write these scripts.
  • Check that your devtmpfs is automounted by your kernel at boot time. If it is not, add the -d 1 option to the s6-linux-init-maker command line below.
  • As root, run:
    @@ -53,8 +49,61 @@ add the -d 1 option to the s6-linux-init-maker command line be
     s6-halt,
     s6-poweroff or
     s6-reboot command as appropriate. 
  • + + +

    What should go into /etc/rc.init and /etc/rc.shutdown ?

    + +

    /etc/rc.init

    + +

    + This script will be run after s6-linux-init has done is job, i.e. +s6-svscan is running as process 1, and it +is now up to /etc/rc.init to get the machine to its usable state. +It normally contains a call to the service manager to bring up all the services; +for instance, if you're using +s6-rc as your service manager, and +your top bundle (containing all the services you want to bring up) is named +ok-all, a proper /etc/rc.init could look like this: +

    + +
    #!/bin/sh
    +s6-rc-init /run/service && exec s6-rc -u change ok-all
    +
    + +

    + The script can assume that: +

    + + +

    /etc/rc.shutdown

    + +

    + This script is spawned by s6-svscan +when the administrator calls s6-halt, +s6-poweroff or +s6-reboot. When this script exits, the final +shutdown sequence is run, which means that the supervision tree is dismantled, +all processes are killed, the file systems are umounted and the system +undergoes a hardware shutdown or reboot. So the goal of this script is to +bring services down in an orderly fashion and perform all the necessary +cleanups before all remaining processes are summarily killed. +

    + +

    + If you're using s6-rc as your +service manager, a proper /etc/rc.shutdown could look like this: +

    + +
    #!/bin/sh
    +exec s6-rc -da change
    +
    +

    FAQ

    Why is it so complicated to use s6 as an init process? It's much -- cgit v1.3.1