From 4da6b9c320e6b49d38af5cb6b5861480141f24cd Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 6 Oct 2015 16:23:19 +0000 Subject: - add -s support to s6-svscan - change examples to support -s - change examples to invoke s6-rc, remove servicedirs --- examples/ROOT/etc/s6-init/crash | 13 ------------- examples/ROOT/etc/s6-init/init-stage1 | 2 +- examples/ROOT/etc/s6-init/init-stage2 | 20 +++----------------- examples/ROOT/etc/s6-init/init-stage3 | 2 +- examples/ROOT/etc/s6-init/network-config | 5 ----- examples/ROOT/etc/s6-rc/README | 9 +++++++++ 6 files changed, 14 insertions(+), 37 deletions(-) delete mode 100755 examples/ROOT/etc/s6-init/crash delete mode 100755 examples/ROOT/etc/s6-init/network-config create mode 100644 examples/ROOT/etc/s6-rc/README (limited to 'examples/ROOT/etc') diff --git a/examples/ROOT/etc/s6-init/crash b/examples/ROOT/etc/s6-init/crash deleted file mode 100755 index 501e316..0000000 --- a/examples/ROOT/etc/s6-init/crash +++ /dev/null @@ -1,13 +0,0 @@ -#!/command/execlineb -P - -# This file is run when an unrecoverable error happens -# to s6-svscan. Edit it to suit your needs. - -cd / -redirfd -r 0 /dev/console -redirfd -w 1 /dev/console -fdmove -c 2 1 - -foreground { s6-echo "s6-svscan panicked! Dropping to a root shell.\n" } - -/bin/sh -i diff --git a/examples/ROOT/etc/s6-init/init-stage1 b/examples/ROOT/etc/s6-init/init-stage1 index a06b015..810948b 100755 --- a/examples/ROOT/etc/s6-init/init-stage1 +++ b/examples/ROOT/etc/s6-init/init-stage1 @@ -56,4 +56,4 @@ background unexport ! # Start stage 2. -s6-svscan -t0 /service +s6-svscan -st0 /service diff --git a/examples/ROOT/etc/s6-init/init-stage2 b/examples/ROOT/etc/s6-init/init-stage2 index 58ac98d..86f31a5 100755 --- a/examples/ROOT/etc/s6-init/init-stage2 +++ b/examples/ROOT/etc/s6-init/init-stage2 @@ -4,7 +4,6 @@ # starts. It should perform all the remaining one-time initialization # tasks. - if -nt { @@ -12,22 +11,9 @@ if -nt # NOT on /dev/console ! if { s6-echo "* init-stage2 starting." } -# Call your one-time early initialization scripts (before bringing -# the network up) here: -# set the hostname, mount filesystems, adjust sysctls, etc. -# if { s6-mount -wt devpts -o noexec,nosuid,gid=0,mode=0600 devpts /dev/pts } -# if { s6-mount -wt ext4 /dev/sda3 /mnt/rwfs } - -# Start the local services - if { s6-hiercopy /img/services-local /service } - if { s6-svscanctl -a /service } - -# Bring up the network - if { /etc/s6-init/network-config } - -# Start the late services - if { s6-hiercopy /img/services-network /service } - if { s6-svscanctl -a /service } +# Call your service manager commands here to run the boot scripts. + if { s6-rc-init /service } + if { s6-rc -u change normal-state } # We're done and the machine is fully operational. s6-echo "* init-stage2 completed." diff --git a/examples/ROOT/etc/s6-init/init-stage3 b/examples/ROOT/etc/s6-init/init-stage3 index 66b3062..ff28372 100755 --- a/examples/ROOT/etc/s6-init/init-stage3 +++ b/examples/ROOT/etc/s6-init/init-stage3 @@ -13,7 +13,7 @@ foreground { s6-echo "Syncing disks." } foreground { s6-sync } -# Even if s6-svscan properly brought all the services down +# Even if s6-rc and s6-svscan properly brought all the services down # before exec'ing into this script, users might have launched # background nohup processes, so we have to kill everything. diff --git a/examples/ROOT/etc/s6-init/network-config b/examples/ROOT/etc/s6-init/network-config deleted file mode 100755 index 2f9e3cd..0000000 --- a/examples/ROOT/etc/s6-init/network-config +++ /dev/null @@ -1,5 +0,0 @@ -#!/command/execlineb -P - -# if { ifconfig lo 127.0.0.1 netmask 255.0.0.0 } - -# Configure your network interfaces and routing here. diff --git a/examples/ROOT/etc/s6-rc/README b/examples/ROOT/etc/s6-rc/README new file mode 100644 index 0000000..959f280 --- /dev/null +++ b/examples/ROOT/etc/s6-rc/README @@ -0,0 +1,9 @@ + If you are using s6-rc as your service manager, this directory should +be the place where you store your compiled service databases. + + The /etc/s6-init/init-stage2 script invokes s6-rc which expects to +find its data here by default. + + The /run/service/.s6-svscan/SIG{INT,USR1,USR2} scripts invoke +s6-rc to bring down all the managed services before shutting down +s6-svscan. -- cgit v1.2.3