Re: s6-svscanboot, how to exit?
2017-07-14 13:00 GMT-03:00 Jean Louis:
>
> However, the VPS servers don't have much option
> left to me, I can install my own system with s6,
> or I can use the ready Debian, Ubuntu and similar.
OK, quick summary if you are stuck with systemd but want the least
possible interaction with it, and a supervised s6-svscan process.
Untested because I don't have access to a systemd machine and am not
planning to, but it is what I would try.
Assuming you have s6 and execline binaries in /command and the s6 scan
directory in /service, as your OP implies:
1) Copy the s6-svscanboot script from the 'examples' subdirectory of
the s6 source tarball to /command. That execline script starts a
supervision tree with a catch-all logger implemented with s6-log,
which you will probably prefer over the systemd journal, but you need
a service directory for it.
2) Install the s6-linux-init package, and do as root:
s6-envuidgid xxx s6-linux-init-maker -b /command -l /service -U yyy
Where 'xxx' is the efective user you want the catch-all logger to run
as. A new subdirectory with the name you specify as 'yyy' will be
created in your working directory.
3) Copy the directory named 's6-svscan-log' from yyy/run-image/service
to /service. *Do that preserving ownership and permissions!* That is
your catch-all logger service directory.
4) Copy the directory named 'uncaught-logs' from yyy/run-image to
/service. *Do that preserving ownership and permissions!* That is the
s6-log logging directory where your supervision tree messages will go
to instead of systemd's journal.
5) Delete the 'redirfd -w 2 /dev/console' line from
/service/s6-svscan-log/run, since s6-svscan will not be running as
process 1. The catch-all logger's error messages will go to systemd's
journal.
6) Put this as /service/.s6-svscan/finish (unless you want to do more there):
#!/command/execlineb -P
# That is a capital 'X'
foreground { s6-svc -X /service/s6-svscan-log }
exit 0
That will make the catch-all logger and its s6-supervise parent exit
cleanly when the supervision tree is stopped
7) Create a /service/.s6-svscan/env environment directory with the
environment variables you want the supervision tree to run with. It
should at least contain PATH, because s6-svscanboot contains an 'exec
-c' command that will wipe the environment inherited from systemd.
8) Make a /etc/systemd/system/s6-svscan.service service unit file
(/etc/systemd/system because it is an administrator-supplied unit
file):
[Unit]
Description=Supervised s6-svscan
[Service]
#Type=simple is the default
ExecStart=/command/s6-svscanboot
Restart=always
#Could also be Restart=on-failure
[Install]
WantedBy=multi-user.target
After all of this (as root probably):
systemctl enable s6-svscan.service should configure systemd to start
the supervision tree each time the machine boots.
systemctl start s6-svscan.service should start the supervision tree manually.
systemctl stop s6-svscan.service should stop the supervision tree manually.
G.
Received on Sat Jul 15 2017 - 15:55:59 UTC
This archive was generated by hypermail 2.3.0
: Sun May 09 2021 - 19:44:19 UTC