dinit.8.m4 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. changequote(`@@@',`$$$')dnl
  2. @@@.TH DINIT "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
  3. .SH NAME
  4. dinit \- supervise processes and manage services
  5. .\"
  6. .SH SYNOPSIS
  7. .\"
  8. .nh
  9. .\"
  10. .HP
  11. .B dinit
  12. [OPTION]... [\fIservice-name\fR]...
  13. .\"
  14. .hy
  15. .\"
  16. .SH DESCRIPTION
  17. .\"
  18. \fBDinit\fR is a process supervisor and service manager which can also
  19. function as a system \fBinit\fR process.
  20. It has a small but functional feature set, offering service dependency handling, parallel startup,
  21. automatic rate-limited restart of failing processes, and service control functions.
  22. .LP
  23. Dinit can be run as a system instance (when run as the root user or when
  24. specified via command line parameter) or as a user instance.
  25. This affects the default paths used to locate certain files.
  26. .LP
  27. When run as PID 1, the first process, Dinit by default acts as a system manager and
  28. shuts down or reboots the system on request (including on receipt of certain signals).
  29. This is currently fully supported only on Linux.
  30. See \fBRUNNING AS SYSTEM MANAGER / PRIMARY INIT\fR.
  31. .LP
  32. Dinit reads service descriptions from files located in a service
  33. description directory, normally one of \fI/etc/dinit.d\fR,
  34. \fI/usr/local/lib/dinit.d\fR or \fI/lib/dinit.d\fR for the system instance
  35. or just \fI$HOME/.config/dinit.d\fR when run as a user process.
  36. See \fBSERVICE DESCRIPTION FILES\fR for details of the service description format.
  37. .\"
  38. .SH OPTIONS
  39. .TP
  40. \fB\-d\fR \fIdir\fP, \fB\-\-services\-dir\fR \fIdir\fP
  41. Specifies \fIdir\fP as the directory containing service definition files.
  42. This can be specified multiple times for multiple service directories.
  43. The default directories are not searched for services when this option is provided.
  44. .sp
  45. If not specified, the default is \fI$HOME/.config/dinit.d\fR or, for the
  46. system service manager, each of \fI/etc/dinit.d\fR, \fI/usr/local/lib/dinit.d\fR,
  47. and \fI/lib/dinit.d\fR (searched in that order).
  48. .TP
  49. \fB\-e\fR \fIfile\fP, \fB\-\-env\-file\fR \fIfile\fP
  50. Read initial environment from \fIfile\fP.
  51. For the system init process, the default is \fI/etc/dinit/environment\fR; see \fBFILES\fR.
  52. .TP
  53. \fB\-p\fR \fIpath\fP, \fB\-\-socket\-path\fR \fIpath\fP
  54. Specifies \fIpath\fP as the path to the control socket used to listen for
  55. commands from the \fBdinitctl\fR program.
  56. The default for the system service manager is usually \fI/dev/dinitctl\fR (but can be configured at build time).
  57. For a user service manager the default is either \fI$XDG_RUNTIME_DIR/dinitctl\fR
  58. or \fI$HOME/.dinitctl\fR, depending on whether \fI$XDG_RUNTIME_DIR\fR is set.
  59. .TP
  60. \fB\-l\fR \fIpath\fP, \fB\-\-log\-file\fR \fIpath\fP
  61. Species \fIpath\fP as the path to the log file, to which Dinit will log status
  62. and error messages.
  63. Note that when running as the system service manager, Dinit
  64. does not begin logging until the log service has started.
  65. Using this option inhibits logging via the syslog facility, however, all logging messages are
  66. duplicated as usual to the console (so long as no service owns the console).
  67. .TP
  68. \fB\-s\fR, \fB\-\-system\fR
  69. Run as the system service manager.
  70. This is the default if invoked as the root user.
  71. This option affects the default service definition directory and control socket path.
  72. .TP
  73. \fB\-m\fR, \fB\-\-system\-mgr\fR
  74. Run as the system manager (perform operations directly related to machine startup
  75. and shutdown).
  76. This is the default when running as process ID 1.
  77. The main user-visible effect of this option is to invoke the \fBshutdown\fR program when a shutdown is
  78. requested (and after all services have stopped), and to provide some basic support
  79. for system recovery in case the \fBboot\fR service (or other specified service)
  80. cannot be started.
  81. .TP
  82. \fB\-u\fR, \fB\-\-user\fR
  83. Run as a user service manager.
  84. This is the opposite of \fB\-\-system\fR, and is the default if not invoked as the root user.
  85. .TP
  86. \fB\-o\fR, \fB\-\-container\fR
  87. Run in "container mode", i.e. do not perform system management functions (such
  88. as shutdown/reboot).
  89. The \fBdinit\fR daemon will simply exit rather than executing the \fBshutdown\fR program.
  90. .TP
  91. \fB\-q\fR, \fB\-\-quiet\fR
  92. Run with no output to the terminal/console.
  93. This disables service status messages and sets the log level for the console log to \fBNONE\fR.
  94. .TP
  95. \fB\-b\fR \fIpath\fR, \fB\-\-cgroup\-path\fR \fIpath\fR
  96. Specify the path to resolve relative cgroup paths against.
  97. If service description settings contain relative cgroup paths, they will be resolved relative to
  98. this path.
  99. This option is only available if \fBdinit\fR is built with cgroups support.
  100. .TP
  101. \fB\-\-help\fR
  102. Display brief help text and then exit.
  103. \fB\-\-version\fR
  104. Display version number and then exit.
  105. .TP
  106. \fIservice-name\fR
  107. Specifies the name of a service that should be started (along with its
  108. dependencies).
  109. If none are specified, defaults to \fIboot\fR (which requires that a suitable service description
  110. for the \fIboot\fR service exists).
  111. .sp
  112. \fBNote:\fR on Linux, if \fBdinit\fR is running as PID 1 and with UID 0, it will ignore
  113. service names provided on the command line, other than "single", unless they appear
  114. anywhere after the "\-o" or "\-m" options (or their long forms).
  115. This is to filter arguments that were intended for the kernel and not for \fBinit\fR.
  116. If running in a container, the "\-o" option should be used regardless and will inhibit this
  117. filtering for any subsequent service names.
  118. .\"
  119. .SH SERVICE DESCRIPTION FILES
  120. .\"
  121. Service description files specify the parameters of each service.
  122. They are named for the service they describe, and are found in \fI/etc/dinit.d\fR
  123. for a system instance or \fI$HOME/.config/dinit.d\fR for a user instance.
  124. .LP
  125. Service description files are read by Dinit on an "as needed" basis.
  126. Once a service description has been read the configuration can be altered or reloaded via the
  127. \fBdinitctl\fR(8) program (with some limitations).
  128. .LP
  129. See \fBdinit-service\fR(5) for details of the format and available parameters.
  130. .\"
  131. .SH SPECIAL SERVICE NAMES
  132. .\"
  133. There are two service names that are "special" to Dinit.
  134. .LP
  135. The \fIboot\fR service is the service that Dinit starts by default, if no
  136. other service names are provided when it is started.
  137. .LP
  138. The \fIrecovery\fR service is a service that Dinit will offer to start if
  139. boot appears to fail (that is, if all services stop without a shutdown command
  140. having been issued), when Dinit is running as system manager.
  141. .\"
  142. .SH OPERATION
  143. .\"
  144. On starting, Dinit starts the initial service(s) as specified on the command line.
  145. Starting a service also causes the dependencies of that service to start, and any service
  146. processes will not be launched until the dependencies are satisfied.
  147. Similarly, stopping a service first stops any dependent services.
  148. .LP
  149. During execution, Dinit accepts commands via a control socket which is created
  150. by Dinit when it starts.
  151. This can be used to order that a service be started or stopped, to determine service status, or to
  152. make certain configuration changes.
  153. See \fBdinitctl\fR(8) for details.
  154. Dinit attempts to check for the existence of an already-active socket first, and will refuse to
  155. start if one exists.
  156. Unfortunately, this check cannot be done atomically, and should not be relied upon generally as a
  157. means to avoid starting two instances of dinit.
  158. .LP
  159. Process-based services are monitored and, if the process terminates, the service may be stopped or
  160. the process may be re-started, according to the configuration in the service description.
  161. .LP
  162. Once all services stop, the \fBdinit\fR daemon will itself terminate (or, if
  163. running as system manager, will perform the appropriate type of system shutdown).
  164. .\"
  165. .SS CHARACTER SET HANDLING
  166. .\"
  167. Dinit does no character set translation.
  168. Dinit's own output is in the execution character set as determined at compilation, as is the interpretation of input.
  169. Service names (and other user-defined inputs) are interpreted as byte sequences and are output as they were read.
  170. In general, modern systems use the UTF-8 character set universally and no problems will arise;
  171. however, systems configured to use other character sets may see odd behaviour if the input
  172. character set does not match the output character set, or if either input or output character sets
  173. are not a superset of the execution character set.
  174. .\"
  175. .SS RUNNING AS SYSTEM MANAGER / PRIMARY INIT
  176. .\"
  177. Running as the system manager (primary \fBinit\fR) is currently supported only on
  178. Linux.
  179. When run as process ID 1, the \fBdinit\fR daemon by default assumes responsibility for
  180. system shutdown and restart (partially relying on external utilities which are
  181. part of the Dinit distribution).
  182. .LP
  183. When not running as a system manager, \fBdinit\fR assumes responsibility only for
  184. service management.
  185. System shutdown or restart need to be handled by the primary \fBinit\fR, which should start
  186. \fBdinit\fR on normal startup, and terminate \fBdinit\fR before shutdown, by signalling it and
  187. waiting for it to terminate after stopping services (possibly by invoking \fBdinitctl shutdown\fR).
  188. .\"
  189. .SH COMMAND LINE FROM KERNEL
  190. .LP
  191. When running as PID 1, \fBdinit\fR may process the command line differently, to compensate for kernel behaviour.
  192. .LP
  193. On Linux, kernel command line options that are not recognised by the kernel will be passed on to \fBdinit\fR.
  194. However, bugs in some kernel versions may cause some options that are recognised to also be passed to \fBdinit\fR.
  195. Also, boot managers may insert command-line options such as "\fBauto\fR" (which indicates an "unattended" boot).
  196. Therefore, \fBdinit\fR ignores all "word like" options other than "\fBsingle\fR", which it treats as
  197. the name of the service to start (thus allowing "single user mode", assuming that a suitable service description exists).
  198. Options beginning with "\fB--\fR" will not be recognised by the kernel and will be passed to (and processed by) \fBdinit\fR;
  199. for example \fB\-\-quiet\fR can be used to suppress console output. Options containing "=" that are unrecognised by the
  200. kernel (or some that are, due to bugs) are passed to init via the environment rather than via the command line.
  201. .\"
  202. .SH FILES
  203. .\"
  204. .TP
  205. \fI/etc/dinit/environment\fR
  206. Default location of the environment file for Dinit when run as a system
  207. instance (for user instances there is no default).
  208. Values are specified as \fINAME\fR=\fIVALUE\fR, one per line, and add to and replace variables present
  209. in the environment when Dinit started.
  210. Lines beginning with a hash character (#) are ignored.
  211. .\"
  212. .SH SIGNALS
  213. .LP
  214. When run as a system manager, SIGINT stops all services and performs a reboot (on Linux, this signal can be
  215. generated using the control-alt-delete key combination); SIGTERM stops services and halts the system; and
  216. SIGQUIT performs an immediate shutdown with no service rollback.
  217. .LP
  218. When run as a user process or system service manager only, SIGINT and SIGTERM both stop services
  219. and exit Dinit; SIGQUIT exits Dinit immediately.
  220. .\"
  221. .SH SEE ALSO
  222. .\"
  223. \fBdinitctl\fR(8), \fBdinit-service\fR(5), \fBdinitcheck\fR(8).
  224. .\"
  225. .SH AUTHOR
  226. Dinit, and this manual, were written by Davin McCall.
  227. $$$dnl