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/img/tmpfs/service/.s6-svscan/README | 11 +++++++++-- examples/ROOT/img/tmpfs/service/.s6-svscan/SIGINT | 3 +++ examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR1 | 3 +++ examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR2 | 3 +++ examples/ROOT/img/tmpfs/service/.s6-svscan/crash | 14 +++++++++++++- 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100755 examples/ROOT/img/tmpfs/service/.s6-svscan/SIGINT create mode 100755 examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR1 create mode 100755 examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR2 mode change 120000 => 100755 examples/ROOT/img/tmpfs/service/.s6-svscan/crash (limited to 'examples/ROOT/img/tmpfs/service') diff --git a/examples/ROOT/img/tmpfs/service/.s6-svscan/README b/examples/ROOT/img/tmpfs/service/.s6-svscan/README index 6500cc6..f61dc8d 100644 --- a/examples/ROOT/img/tmpfs/service/.s6-svscan/README +++ b/examples/ROOT/img/tmpfs/service/.s6-svscan/README @@ -1,2 +1,9 @@ -This is the image of the control directory of the s6-svscan process. -Notice how the symlinks point to ever-existing scripts. +This is the image of the control directory of the s6-svscan process +running as pid 1. +"crash" is run if s6-svscan fails. +"finish" is run when s6-svscan exits its loop. + + The "SIG*" files are run as children of s6-svscan when it receives +the corresponding signal. SIGINT, SIGUSR1 and SIGUSR2 will all +trigger "s6-rc -da change" (the service manager will shut down all +the services), then s6-svscan will be told to exit its loop. diff --git a/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGINT b/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGINT new file mode 100755 index 0000000..f0ff213 --- /dev/null +++ b/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGINT @@ -0,0 +1,3 @@ +#!/command/execlineb -P +foreground { s6-rc -da change } +s6-svscanctl -6 . diff --git a/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR1 b/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR1 new file mode 100755 index 0000000..cb4a4ef --- /dev/null +++ b/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR1 @@ -0,0 +1,3 @@ +#!/command/execlineb -P +foreground { s6-rc -da change } +s6-svscanctl -0 . diff --git a/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR2 b/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR2 new file mode 100755 index 0000000..e5932be --- /dev/null +++ b/examples/ROOT/img/tmpfs/service/.s6-svscan/SIGUSR2 @@ -0,0 +1,3 @@ +#!/command/execlineb -P +foreground { s6-rc -da change } +s6-svscanctl -7 . diff --git a/examples/ROOT/img/tmpfs/service/.s6-svscan/crash b/examples/ROOT/img/tmpfs/service/.s6-svscan/crash deleted file mode 120000 index 262c196..0000000 --- a/examples/ROOT/img/tmpfs/service/.s6-svscan/crash +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-init/crash \ No newline at end of file diff --git a/examples/ROOT/img/tmpfs/service/.s6-svscan/crash b/examples/ROOT/img/tmpfs/service/.s6-svscan/crash new file mode 100755 index 0000000..501e316 --- /dev/null +++ b/examples/ROOT/img/tmpfs/service/.s6-svscan/crash @@ -0,0 +1,13 @@ +#!/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 -- cgit v1.2.3