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 +++++++++ examples/ROOT/img/README | 11 +++-------- examples/ROOT/img/services-local/README | 5 ----- examples/ROOT/img/services-local/klogd-linux/README | 3 --- .../ROOT/img/services-local/klogd-linux/log/README | 1 - examples/ROOT/img/services-local/klogd-linux/log/run | 4 ---- examples/ROOT/img/services-local/klogd-linux/run | 5 ----- .../ROOT/img/services-local/syslogd-linux/README | 7 ------- .../ROOT/img/services-local/syslogd-linux/log/README | 9 --------- .../services-local/syslogd-linux/log/env/LOGSCRIPT | 6 ------ .../ROOT/img/services-local/syslogd-linux/log/run | 8 -------- .../img/services-local/syslogd-linux/notification-fd | 1 - examples/ROOT/img/services-local/syslogd-linux/run | 8 -------- examples/ROOT/img/services-network/README | 5 ----- examples/ROOT/img/services-network/dns-cache/README | 2 -- .../img/services-network/dns-cache/env/CACHESIZE | 1 - examples/ROOT/img/services-network/dns-cache/env/IP | 1 - .../ROOT/img/services-network/dns-cache/env/IPSEND | 1 - .../ROOT/img/services-network/dns-cache/env/ROOT | 1 - .../ROOT/img/services-network/dns-cache/log/README | 3 --- examples/ROOT/img/services-network/dns-cache/log/run | 4 ---- .../img/services-network/dns-cache/root/ip/127.0.0.1 | 0 .../img/services-network/dns-cache/root/servers/@ | 13 ------------- examples/ROOT/img/services-network/dns-cache/run | 12 ------------ .../ROOT/img/services-network/fifodir-cleanup/README | 2 -- .../ROOT/img/services-network/fifodir-cleanup/run | 14 -------------- examples/ROOT/img/services-network/ntpclient/README | 9 --------- .../ROOT/img/services-network/ntpclient/log/README | 3 --- examples/ROOT/img/services-network/ntpclient/log/run | 4 ---- examples/ROOT/img/services-network/ntpclient/run | 19 ------------------- examples/ROOT/img/services-network/sshd/README | 5 ----- examples/ROOT/img/services-network/sshd/log/README | 1 - examples/ROOT/img/services-network/sshd/log/run | 4 ---- .../ROOT/img/services-network/sshd/notification-fd | 1 - .../services-network/sshd/rules/ip4/0.0.0.0_0/deny | 0 .../sshd/rules/ip4/127.0.0.1_32/allow | 0 examples/ROOT/img/services-network/sshd/run | 6 ------ 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 +++++++++++++- examples/ROOT/run | 1 + examples/klogd-linux/README | 5 +++++ examples/klogd-linux/log/README | 1 + examples/klogd-linux/log/run | 4 ++++ examples/klogd-linux/run | 5 +++++ examples/syslogd-linux/README | 9 +++++++++ examples/syslogd-linux/log/README | 9 +++++++++ examples/syslogd-linux/log/env/LOGSCRIPT | 6 ++++++ examples/syslogd-linux/log/run | 8 ++++++++ examples/syslogd-linux/notification-fd | 1 + examples/syslogd-linux/run | 8 ++++++++ 58 files changed, 105 insertions(+), 216 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 delete mode 100644 examples/ROOT/img/services-local/README delete mode 100644 examples/ROOT/img/services-local/klogd-linux/README delete mode 100644 examples/ROOT/img/services-local/klogd-linux/log/README delete mode 100755 examples/ROOT/img/services-local/klogd-linux/log/run delete mode 100755 examples/ROOT/img/services-local/klogd-linux/run delete mode 100644 examples/ROOT/img/services-local/syslogd-linux/README delete mode 100644 examples/ROOT/img/services-local/syslogd-linux/log/README delete mode 100644 examples/ROOT/img/services-local/syslogd-linux/log/env/LOGSCRIPT delete mode 100755 examples/ROOT/img/services-local/syslogd-linux/log/run delete mode 100644 examples/ROOT/img/services-local/syslogd-linux/notification-fd delete mode 100755 examples/ROOT/img/services-local/syslogd-linux/run delete mode 100644 examples/ROOT/img/services-network/README delete mode 100644 examples/ROOT/img/services-network/dns-cache/README delete mode 100644 examples/ROOT/img/services-network/dns-cache/env/CACHESIZE delete mode 100644 examples/ROOT/img/services-network/dns-cache/env/IP delete mode 100644 examples/ROOT/img/services-network/dns-cache/env/IPSEND delete mode 100644 examples/ROOT/img/services-network/dns-cache/env/ROOT delete mode 100644 examples/ROOT/img/services-network/dns-cache/log/README delete mode 100755 examples/ROOT/img/services-network/dns-cache/log/run delete mode 100644 examples/ROOT/img/services-network/dns-cache/root/ip/127.0.0.1 delete mode 100644 examples/ROOT/img/services-network/dns-cache/root/servers/@ delete mode 100755 examples/ROOT/img/services-network/dns-cache/run delete mode 100644 examples/ROOT/img/services-network/fifodir-cleanup/README delete mode 100755 examples/ROOT/img/services-network/fifodir-cleanup/run delete mode 100644 examples/ROOT/img/services-network/ntpclient/README delete mode 100644 examples/ROOT/img/services-network/ntpclient/log/README delete mode 100755 examples/ROOT/img/services-network/ntpclient/log/run delete mode 100755 examples/ROOT/img/services-network/ntpclient/run delete mode 100644 examples/ROOT/img/services-network/sshd/README delete mode 100644 examples/ROOT/img/services-network/sshd/log/README delete mode 100755 examples/ROOT/img/services-network/sshd/log/run delete mode 100644 examples/ROOT/img/services-network/sshd/notification-fd delete mode 100644 examples/ROOT/img/services-network/sshd/rules/ip4/0.0.0.0_0/deny delete mode 100644 examples/ROOT/img/services-network/sshd/rules/ip4/127.0.0.1_32/allow delete mode 100755 examples/ROOT/img/services-network/sshd/run 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 create mode 120000 examples/ROOT/run create mode 100644 examples/klogd-linux/README create mode 100644 examples/klogd-linux/log/README create mode 100755 examples/klogd-linux/log/run create mode 100755 examples/klogd-linux/run create mode 100644 examples/syslogd-linux/README create mode 100644 examples/syslogd-linux/log/README create mode 100644 examples/syslogd-linux/log/env/LOGSCRIPT create mode 100755 examples/syslogd-linux/log/run create mode 100644 examples/syslogd-linux/notification-fd create mode 100755 examples/syslogd-linux/run (limited to 'examples') 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. diff --git a/examples/ROOT/img/README b/examples/ROOT/img/README index 8181be3..185a3e6 100644 --- a/examples/ROOT/img/README +++ b/examples/ROOT/img/README @@ -1,9 +1,4 @@ -This directory is read-only. It contains the service -repository (actually one list of services that do not -need the network and one list of services that can only -be started after the network is up), and an image of the +This directory is read-only. It contains an image of the tmpfs that it copied as-is at boot-time (during stage 1 -init). -This directory is only used at boot-time, it is never -written to (the service directories are copied as-is -to /service during stage 2 init). +init). It is only used at boot-time, it is never +written to. diff --git a/examples/ROOT/img/services-local/README b/examples/ROOT/img/services-local/README deleted file mode 100644 index 9e4c027..0000000 --- a/examples/ROOT/img/services-local/README +++ /dev/null @@ -1,5 +0,0 @@ -This is the service repository for services that should be started -early, typically before the network goes up. -"klogd" and "syslogd" services should be present as soon as possible, -because other services might need them. However, since they need -a writable disk filesystem, they can't be run as early as a getty. diff --git a/examples/ROOT/img/services-local/klogd-linux/README b/examples/ROOT/img/services-local/klogd-linux/README deleted file mode 100644 index ec95a00..0000000 --- a/examples/ROOT/img/services-local/klogd-linux/README +++ /dev/null @@ -1,3 +0,0 @@ -This klogd emulation is only valid under Linux. -The service only processes logs from /proc/kmsg and -sends them to stdout, i.e. its own logger. diff --git a/examples/ROOT/img/services-local/klogd-linux/log/README b/examples/ROOT/img/services-local/klogd-linux/log/README deleted file mode 100644 index 6b51a4a..0000000 --- a/examples/ROOT/img/services-local/klogd-linux/log/README +++ /dev/null @@ -1 +0,0 @@ -Processed kernel logs will be logged to the /var/log/klogd/ logdir. diff --git a/examples/ROOT/img/services-local/klogd-linux/log/run b/examples/ROOT/img/services-local/klogd-linux/log/run deleted file mode 100755 index d9659e7..0000000 --- a/examples/ROOT/img/services-local/klogd-linux/log/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/command/execlineb -P -s6-setuidgid klog -exec -c -s6-log t s1000000 n20 /var/log/klogd diff --git a/examples/ROOT/img/services-local/klogd-linux/run b/examples/ROOT/img/services-local/klogd-linux/run deleted file mode 100755 index 453b55b..0000000 --- a/examples/ROOT/img/services-local/klogd-linux/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/command/execlineb -P -fdmove -c 2 1 -redirfd -r 0 /proc/kmsg -exec -c -ucspilogd diff --git a/examples/ROOT/img/services-local/syslogd-linux/README b/examples/ROOT/img/services-local/syslogd-linux/README deleted file mode 100644 index a3c3ba4..0000000 --- a/examples/ROOT/img/services-local/syslogd-linux/README +++ /dev/null @@ -1,7 +0,0 @@ -This syslogd emulation works on any Unix where syslog() is -implemented via a connection on the /dev/log Unix-domain socket. -It needs a Unix superserver (see s6-networking, ucspi-unix or -ucspi-ipc) and ucspilogd. -A ucspilogd process is spawned for every syslog() client. It -processes logs and sends them to stderr, i.e. the service's -logger. diff --git a/examples/ROOT/img/services-local/syslogd-linux/log/README b/examples/ROOT/img/services-local/syslogd-linux/log/README deleted file mode 100644 index 9d4968e..0000000 --- a/examples/ROOT/img/services-local/syslogd-linux/log/README +++ /dev/null @@ -1,9 +0,0 @@ - This logger service logs everything the syslogd service receives -into subdirectories of /var/log/syslogd/ logdir. - - The script provided in env/LOGSCRIPT emulates the default -syslogd behaviour on a majority of Linux distributions. - - Note that spaces cannot be used as is in the LOGSCRIPT file, -because they are delimiters for the splitting of $LOGSCRIPT -in the run script. So \s is used instead. diff --git a/examples/ROOT/img/services-local/syslogd-linux/log/env/LOGSCRIPT b/examples/ROOT/img/services-local/syslogd-linux/log/env/LOGSCRIPT deleted file mode 100644 index e7a1eb7..0000000 --- a/examples/ROOT/img/services-local/syslogd-linux/log/env/LOGSCRIPT +++ /dev/null @@ -1,6 +0,0 @@ -- +^[0-9]+:\s[0-9]+:\serror\. t /var/log/syslogd/error -- +^[0-9]+:\s[0-9]+:\sauthpriv\. t /var/log/syslogd/auth -- +^[0-9]+:\s[0-9]+:\suser\. t /var/log/syslogd/user -- +^[0-9]+:\s[0-9]+:\smessages\. t /var/log/syslogd/messages -- +^[0-9]+:\s[0-9]+:\sdaemon\. t /var/log/syslogd/daemon -f t /var/log/syslogd/misc diff --git a/examples/ROOT/img/services-local/syslogd-linux/log/run b/examples/ROOT/img/services-local/syslogd-linux/log/run deleted file mode 100755 index 56de271..0000000 --- a/examples/ROOT/img/services-local/syslogd-linux/log/run +++ /dev/null @@ -1,8 +0,0 @@ -#!/command/execlineb -P -s6-setuidgid syslog -s6-envdir -f env -import -Cs LOGSCRIPT -exec -c -s6-log $LOGSCRIPT - -# Change env/LOGSCRIPT to alter s6-log's behaviour diff --git a/examples/ROOT/img/services-local/syslogd-linux/notification-fd b/examples/ROOT/img/services-local/syslogd-linux/notification-fd deleted file mode 100644 index 00750ed..0000000 --- a/examples/ROOT/img/services-local/syslogd-linux/notification-fd +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/examples/ROOT/img/services-local/syslogd-linux/run b/examples/ROOT/img/services-local/syslogd-linux/run deleted file mode 100755 index de33c2c..0000000 --- a/examples/ROOT/img/services-local/syslogd-linux/run +++ /dev/null @@ -1,8 +0,0 @@ -#!/command/execlineb -P -fdmove -c 2 1 -exec -c -s6-envuidgid nobody -fdmove 1 3 -s6-ipcserver -U -1 -- /dev/log -fdmove -c 1 2 -ucspilogd IPCREMOTEEUID IPCREMOTEEGID diff --git a/examples/ROOT/img/services-network/README b/examples/ROOT/img/services-network/README deleted file mode 100644 index 9f4ab38..0000000 --- a/examples/ROOT/img/services-network/README +++ /dev/null @@ -1,5 +0,0 @@ -This is the service repository for all the late services, -i.e. those that do not need to be started before the network -is up. -Only a few examples are provided here; you can make your own -service directories depending on your needs. diff --git a/examples/ROOT/img/services-network/dns-cache/README b/examples/ROOT/img/services-network/dns-cache/README deleted file mode 100644 index 8fc5c28..0000000 --- a/examples/ROOT/img/services-network/dns-cache/README +++ /dev/null @@ -1,2 +0,0 @@ -Service directory for a DNS caching resolver service, -implemented via djbdns's dnscache running on 127.0.0.1 diff --git a/examples/ROOT/img/services-network/dns-cache/env/CACHESIZE b/examples/ROOT/img/services-network/dns-cache/env/CACHESIZE deleted file mode 100644 index 6820bf1..0000000 --- a/examples/ROOT/img/services-network/dns-cache/env/CACHESIZE +++ /dev/null @@ -1 +0,0 @@ -1048576 diff --git a/examples/ROOT/img/services-network/dns-cache/env/IP b/examples/ROOT/img/services-network/dns-cache/env/IP deleted file mode 100644 index 7b9ad53..0000000 --- a/examples/ROOT/img/services-network/dns-cache/env/IP +++ /dev/null @@ -1 +0,0 @@ -127.0.0.1 diff --git a/examples/ROOT/img/services-network/dns-cache/env/IPSEND b/examples/ROOT/img/services-network/dns-cache/env/IPSEND deleted file mode 100644 index d690dc0..0000000 --- a/examples/ROOT/img/services-network/dns-cache/env/IPSEND +++ /dev/null @@ -1 +0,0 @@ -0.0.0.0 diff --git a/examples/ROOT/img/services-network/dns-cache/env/ROOT b/examples/ROOT/img/services-network/dns-cache/env/ROOT deleted file mode 100644 index 0a89945..0000000 --- a/examples/ROOT/img/services-network/dns-cache/env/ROOT +++ /dev/null @@ -1 +0,0 @@ -/service/dns-cache/root diff --git a/examples/ROOT/img/services-network/dns-cache/log/README b/examples/ROOT/img/services-network/dns-cache/log/README deleted file mode 100644 index 55676f1..0000000 --- a/examples/ROOT/img/services-network/dns-cache/log/README +++ /dev/null @@ -1,3 +0,0 @@ -Logger service for the dns-cache service. -djbdns's dnscache produces a lot of output, so -you may want to add log filters. diff --git a/examples/ROOT/img/services-network/dns-cache/log/run b/examples/ROOT/img/services-network/dns-cache/log/run deleted file mode 100755 index 4177eaa..0000000 --- a/examples/ROOT/img/services-network/dns-cache/log/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/command/execlineb -P -s6-setuidgid dnslog -exec -c -s6-log t s1000000 n20 /var/log/dns-cache diff --git a/examples/ROOT/img/services-network/dns-cache/root/ip/127.0.0.1 b/examples/ROOT/img/services-network/dns-cache/root/ip/127.0.0.1 deleted file mode 100644 index e69de29..0000000 diff --git a/examples/ROOT/img/services-network/dns-cache/root/servers/@ b/examples/ROOT/img/services-network/dns-cache/root/servers/@ deleted file mode 100644 index ca40b38..0000000 --- a/examples/ROOT/img/services-network/dns-cache/root/servers/@ +++ /dev/null @@ -1,13 +0,0 @@ -198.41.0.4 -192.228.79.201 -192.33.4.12 -128.8.10.90 -192.203.230.10 -192.5.5.241 -192.112.36.4 -128.63.2.53 -192.36.148.17 -192.58.128.30 -193.0.14.129 -199.7.83.42 -202.12.27.33 diff --git a/examples/ROOT/img/services-network/dns-cache/run b/examples/ROOT/img/services-network/dns-cache/run deleted file mode 100755 index af92aae..0000000 --- a/examples/ROOT/img/services-network/dns-cache/run +++ /dev/null @@ -1,12 +0,0 @@ -#!/command/execlineb -P -fdmove -c 2 1 -s6-envuidgid dnscache -s6-envdir env -s6-softlimit -m 2000000 -pipeline -d -{ - redirfd -r 0 /dev/urandom - s6-head -c 128 -} -unexport ! -dnscache diff --git a/examples/ROOT/img/services-network/fifodir-cleanup/README b/examples/ROOT/img/services-network/fifodir-cleanup/README deleted file mode 100644 index 2c41ea2..0000000 --- a/examples/ROOT/img/services-network/fifodir-cleanup/README +++ /dev/null @@ -1,2 +0,0 @@ -This service cleans up the fifodirs for all the services in -/service once a day. diff --git a/examples/ROOT/img/services-network/fifodir-cleanup/run b/examples/ROOT/img/services-network/fifodir-cleanup/run deleted file mode 100755 index 9928d84..0000000 --- a/examples/ROOT/img/services-network/fifodir-cleanup/run +++ /dev/null @@ -1,14 +0,0 @@ -#!/command/execlineb -P -fdmove -c 2 1 -if -{ - forbacktickx -p -0 i { s6-ls -0 /service } - import i unexport i - foreground - { - if { s6-test -d /service/${i}/log } - s6-cleanfifodir /service/${i}/log/event - } - s6-cleanfifodir /service/${i}/event -} -s6-sleep 86400 diff --git a/examples/ROOT/img/services-network/ntpclient/README b/examples/ROOT/img/services-network/ntpclient/README deleted file mode 100644 index c4fc357..0000000 --- a/examples/ROOT/img/services-network/ntpclient/README +++ /dev/null @@ -1,9 +0,0 @@ -This service updates the system clock via NTP every 4 hours. -If you're not in France, change 0.fr.pool.ntp.org to a NTP -server pool more fitting your location. -See www.ntp.pool.org for details. - -Do yourself a favor and don't rely on NTP internally. -Just synchronize your main time server via this NTP client -to the outside world, and use a saner and simpler protocol -like TAICLOCK in your internal, fast-speed network. diff --git a/examples/ROOT/img/services-network/ntpclient/log/README b/examples/ROOT/img/services-network/ntpclient/log/README deleted file mode 100644 index e4c7a37..0000000 --- a/examples/ROOT/img/services-network/ntpclient/log/README +++ /dev/null @@ -1,3 +0,0 @@ -Yes, the output of the ntpclient service is logged to -the /var/log/ntpclient logdir. -Make sure it has the correct Unix credentials and permissions! diff --git a/examples/ROOT/img/services-network/ntpclient/log/run b/examples/ROOT/img/services-network/ntpclient/log/run deleted file mode 100755 index 80d7b5b..0000000 --- a/examples/ROOT/img/services-network/ntpclient/log/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/command/execlineb -P -s6-setuidgid ntplog -exec -c -s6-log t /var/log/ntpclient diff --git a/examples/ROOT/img/services-network/ntpclient/run b/examples/ROOT/img/services-network/ntpclient/run deleted file mode 100755 index 7ade064..0000000 --- a/examples/ROOT/img/services-network/ntpclient/run +++ /dev/null @@ -1,19 +0,0 @@ -#!/command/execlineb -P - -fdmove -c 2 1 -if -{ - pipeline - { - s6-setuidgid ntp - backtick -n NTPSERVERIP - { - pipeline { s6-dnsip4 -t 16000 0.fr.pool.ntp.org. } - s6-head -n 1 - } - s6-sntpclock -v $NTPSERVERIP - } - s6-clockadd -} -s6-setuidgid nobody -s6-sleep 14400 diff --git a/examples/ROOT/img/services-network/sshd/README b/examples/ROOT/img/services-network/sshd/README deleted file mode 100644 index 2d55a5e..0000000 --- a/examples/ROOT/img/services-network/sshd/README +++ /dev/null @@ -1,5 +0,0 @@ -Service directory for a sshd server over IPv4, -implemented via s6-networking and dropbear. -The rules subdirectory implements access control; in -this example, only 127.0.0.1 is allowed to connect -(which isn't exactly useful for a SSH server). diff --git a/examples/ROOT/img/services-network/sshd/log/README b/examples/ROOT/img/services-network/sshd/log/README deleted file mode 100644 index 392ede8..0000000 --- a/examples/ROOT/img/services-network/sshd/log/README +++ /dev/null @@ -1 +0,0 @@ -Logging service for sshd. diff --git a/examples/ROOT/img/services-network/sshd/log/run b/examples/ROOT/img/services-network/sshd/log/run deleted file mode 100755 index d07f180..0000000 --- a/examples/ROOT/img/services-network/sshd/log/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/command/execlineb -P -s6-setuidgid log -exec -c -s6-log t s1000000 n20 /var/log/sshd diff --git a/examples/ROOT/img/services-network/sshd/notification-fd b/examples/ROOT/img/services-network/sshd/notification-fd deleted file mode 100644 index 00750ed..0000000 --- a/examples/ROOT/img/services-network/sshd/notification-fd +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/examples/ROOT/img/services-network/sshd/rules/ip4/0.0.0.0_0/deny b/examples/ROOT/img/services-network/sshd/rules/ip4/0.0.0.0_0/deny deleted file mode 100644 index e69de29..0000000 diff --git a/examples/ROOT/img/services-network/sshd/rules/ip4/127.0.0.1_32/allow b/examples/ROOT/img/services-network/sshd/rules/ip4/127.0.0.1_32/allow deleted file mode 100644 index e69de29..0000000 diff --git a/examples/ROOT/img/services-network/sshd/run b/examples/ROOT/img/services-network/sshd/run deleted file mode 100755 index 3a35a11..0000000 --- a/examples/ROOT/img/services-network/sshd/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/command/execlineb -P -fdmove -c 2 1 -fdmove 1 3 -s6-tcpserver4 -1 -- 0.0.0.0 22 -s6-tcpserver-access -vvDRl0 -t 5000 -i rules -dropbear -iEg 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 diff --git a/examples/ROOT/run b/examples/ROOT/run new file mode 120000 index 0000000..cc11a99 --- /dev/null +++ b/examples/ROOT/run @@ -0,0 +1 @@ +mnt/tmpfs \ No newline at end of file diff --git a/examples/klogd-linux/README b/examples/klogd-linux/README new file mode 100644 index 0000000..712cfa3 --- /dev/null +++ b/examples/klogd-linux/README @@ -0,0 +1,5 @@ +This is an example of a service directory for process supervision by s6. + +This klogd emulation is only valid under Linux. +The service only processes logs from /proc/kmsg and +sends them to stdout, i.e. its own logger. diff --git a/examples/klogd-linux/log/README b/examples/klogd-linux/log/README new file mode 100644 index 0000000..6b51a4a --- /dev/null +++ b/examples/klogd-linux/log/README @@ -0,0 +1 @@ +Processed kernel logs will be logged to the /var/log/klogd/ logdir. diff --git a/examples/klogd-linux/log/run b/examples/klogd-linux/log/run new file mode 100755 index 0000000..d9659e7 --- /dev/null +++ b/examples/klogd-linux/log/run @@ -0,0 +1,4 @@ +#!/command/execlineb -P +s6-setuidgid klog +exec -c +s6-log t s1000000 n20 /var/log/klogd diff --git a/examples/klogd-linux/run b/examples/klogd-linux/run new file mode 100755 index 0000000..453b55b --- /dev/null +++ b/examples/klogd-linux/run @@ -0,0 +1,5 @@ +#!/command/execlineb -P +fdmove -c 2 1 +redirfd -r 0 /proc/kmsg +exec -c +ucspilogd diff --git a/examples/syslogd-linux/README b/examples/syslogd-linux/README new file mode 100644 index 0000000..675715b --- /dev/null +++ b/examples/syslogd-linux/README @@ -0,0 +1,9 @@ +This is an example of a service directory for process supervision by s6. + +This syslogd emulation works on any Unix where syslog() is +implemented via a connection on the /dev/log Unix-domain socket. +It needs a Unix superserver (see s6-networking, ucspi-unix or +ucspi-ipc) and ucspilogd. +A ucspilogd process is spawned for every syslog() client. It +processes logs and sends them to stderr, i.e. the service's +logger. diff --git a/examples/syslogd-linux/log/README b/examples/syslogd-linux/log/README new file mode 100644 index 0000000..9d4968e --- /dev/null +++ b/examples/syslogd-linux/log/README @@ -0,0 +1,9 @@ + This logger service logs everything the syslogd service receives +into subdirectories of /var/log/syslogd/ logdir. + + The script provided in env/LOGSCRIPT emulates the default +syslogd behaviour on a majority of Linux distributions. + + Note that spaces cannot be used as is in the LOGSCRIPT file, +because they are delimiters for the splitting of $LOGSCRIPT +in the run script. So \s is used instead. diff --git a/examples/syslogd-linux/log/env/LOGSCRIPT b/examples/syslogd-linux/log/env/LOGSCRIPT new file mode 100644 index 0000000..e7a1eb7 --- /dev/null +++ b/examples/syslogd-linux/log/env/LOGSCRIPT @@ -0,0 +1,6 @@ +- +^[0-9]+:\s[0-9]+:\serror\. t /var/log/syslogd/error +- +^[0-9]+:\s[0-9]+:\sauthpriv\. t /var/log/syslogd/auth +- +^[0-9]+:\s[0-9]+:\suser\. t /var/log/syslogd/user +- +^[0-9]+:\s[0-9]+:\smessages\. t /var/log/syslogd/messages +- +^[0-9]+:\s[0-9]+:\sdaemon\. t /var/log/syslogd/daemon +f t /var/log/syslogd/misc diff --git a/examples/syslogd-linux/log/run b/examples/syslogd-linux/log/run new file mode 100755 index 0000000..56de271 --- /dev/null +++ b/examples/syslogd-linux/log/run @@ -0,0 +1,8 @@ +#!/command/execlineb -P +s6-setuidgid syslog +s6-envdir -f env +import -Cs LOGSCRIPT +exec -c +s6-log $LOGSCRIPT + +# Change env/LOGSCRIPT to alter s6-log's behaviour diff --git a/examples/syslogd-linux/notification-fd b/examples/syslogd-linux/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/examples/syslogd-linux/notification-fd @@ -0,0 +1 @@ +3 diff --git a/examples/syslogd-linux/run b/examples/syslogd-linux/run new file mode 100755 index 0000000..de33c2c --- /dev/null +++ b/examples/syslogd-linux/run @@ -0,0 +1,8 @@ +#!/command/execlineb -P +fdmove -c 2 1 +exec -c +s6-envuidgid nobody +fdmove 1 3 +s6-ipcserver -U -1 -- /dev/log +fdmove -c 1 2 +ucspilogd IPCREMOTEEUID IPCREMOTEEGID -- cgit 1.4.1