As an alternative to the full startup and shutdown mechanisms that involve running the system manager, one can use a mechanism that operates more like traditional daemontools.
The service manager still runs, but instead of being sent control messages by system-control it is sent control messages by service-dt-scanner, which implements old-style daemontools service activation involving a /service/ directory.
Of course, one has to do one's own system management, with some program running as process #1 that invokes service-manager and service-dt-scanner.
Exactly what one uses is beyond the scope of this guide, obviously.
The package comes supplied with some unit files that enable one to run the service manager and old-style scanner under systemd.
service-manager.socket is a systemd socket unit that defines a local-domain datagram socket named /run/service-manager/control.
service-manager.service is a systemd service unit that defines the socket-activated service associated with that socket.
The service runs service-manager, which understands the
systemd LISTEN_FDS convention
and so can be run as a systemd socket-activated service in this manner.
service-manager-svscan.path is a systemd path unit that tells systemd to watch the /service/ directory.
service-manager-svscan.service is a systemd service unit that defines the path-activated service that is associated with that path.
The service runs service-dt-scanner.
You must enable the path and the socket units if you wish to run the service manager under systemd. What happens at system bootstrap, with these enabled, is:
systemd, monitoring the /service/ directory as a result of activating the path unit, sees that the directory is non-empty.
systemd activates the service-manager-svscan.service service, running service-dt-scanner /service/.
service-dt-scanner scans /service/ and for every service found it sends a LOAD command to the /run/service-manager/control socket.
systemd, monitoring the /run/service-manager/control socket as a result of activating the socket unit, sees that requests have arrived on the socket.
systemd activates the service-manager.service service, running service-manager with an open file descriptor for the control socket.
service-manager loads and manages the services that service-dt-scanner tells it to.