Dinit is a service supervisor with dependency support which can also act as the system "init" program. It was created with the intention of providing a portable init system with dependency management, that was functionally superior to many extant inits.
Dinit service packages are named
package_name-dinit and, when installed, will be available in
Nearly every file and directory related to dinit are installed in the /etc/dinit.d directory.
/etc/dinit.d/config/- configurations for dinit services
/etc/dinit.d/boot.d/- dinit services that run on boot
/etc/dinit.d/scripts/- dinit wrapper scripts
/var/log/dinit/- logs for dinit services
/etc/dinit.d/service_name-pre- preparation service, in some cases, this is needed because the "preparation" must be run as root but the service itself must be run as its own user
Nearly every interaction with dinit are done with the
# dinitctl start service_name
# dinitctl stop service_name
# dinitctl restart service_name
# dinitctl enable service_name
# dinitctl disable service_name
# dinitctl list
dinitcheck is usually used if to check if there is any problem with the dinit service directory, it will check for any syntax errors, invalid parameter values, and dependency cycles.
A typical service file looks like this:
type = process | bgprocess | scripted | internal command = /path/to/servicename restart = (boolean) smooth-recovery = (boolean) logfile = ... depends-on = (service name) waits-for = (service name)
There are four types of dinit services:
process, for foreground daemons
bgprocess, for forking daemons
scripted, for oneshots
internal, which is only useful inside dinit and is usually used to "gather" lots of dependencies into one big dependency, or similar to "bundle" in s6.
There are three types of dependencies:
depends-onis hard dependency, so if any service is named here, it must run no matter what before the service is started
depends-msis a milestone dependency, so while the rules of depends-on apply when starting service, if the dependency stopped, the dependent will still run
waits-foris soft dependency, while the service will wait for its dependency to run, it will still run if the dependency fails
For more details, see