2
0

dinit-service.5.m4 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. changequote(`@@@',`$$$')dnl
  2. @@@.TH DINIT-SERVICE "5" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
  3. .SH NAME
  4. Dinit service description files
  5. .\"
  6. .SH SYNOPSIS
  7. .\"
  8. .ft CR
  9. /etc/dinit.d/\fIservice-name\fR, $XDG_CONFIG_HOME/dinit.d/\fIservice-name\fR
  10. .ft
  11. .\"
  12. .SH DESCRIPTION
  13. .\"
  14. The service description files for \fBDinit\fR each describe a service. The name
  15. of the file corresponds to the name of the service it describes (minus its argument;
  16. see \fBSERVICE ARGUMENTS\fR).
  17. .LP
  18. Service description files specify the various attributes of a service.
  19. A service description file is a plain-text file with simple key-value format.
  20. The description files are located in a service description directory;
  21. See \fBdinit\fR(8) for more details of the default service description directories,
  22. and how and when service descriptions are loaded.
  23. .LP
  24. All services have a \fItype\fR and a set of \fIdependencies\fR.
  25. These are discussed in the following subsections.
  26. The type, dependencies, and other attributes are specified via property settings, the format of
  27. which are documented in the \fBSERVICE PROPERTIES\fR subsection, which also lists the available
  28. properties.
  29. .LP
  30. In addition to service properties, some meta-commands can be used within service
  31. description files.
  32. See the \fBMETA-COMMANDS\fR subsection for more information.
  33. .\"
  34. .SS SERVICE ARGUMENTS
  35. .\"
  36. A service description may act as a template for multiple related services.
  37. The full name of a service can include an argument, following the base name of the service
  38. suffixed by an 'at' symbol (\fB@\fR), in the form \fIbase-name@argument\fR.
  39. The argument value may be substituted into various service setting values by using
  40. a '\fB$1\fR' marker in the value specified in the service description (see \fBVARIABLE SUBSTITUTION\fR).
  41. The full name (base name together with argument) uniquely identifies a service instance, and each
  42. instance is loaded separately, remaining independent of other instances.
  43. .\"
  44. .SS SERVICE TYPES
  45. .\"
  46. There are five basic types of service:
  47. .IP \(bu
  48. \fBProcess\fR services. This kind of service runs a single supervised process; the process
  49. is started when the service is started and stopped when the service is stopped. If the
  50. process stops this also affects the service state, i.e. the service's started/stopped state is
  51. linked to the state of its associated process.
  52. .IP \(bu
  53. \fBBgprocess\fR services ("background process" services).
  54. This kind of service is similar to a regular process service, but is for a process which
  55. "daemonizes" or otherwise forks from the original process which starts it, and writes its
  56. new process ID to a file.
  57. Dinit will read the process ID from the file and, if running as the system init process or if the
  58. system provides the necessary facilities, can supervise the process just as for a \fBprocess\fR
  59. service.
  60. When starting a \fBbgprocess\fR service, Dinit will not consider the service to be fully started
  61. until the original process forks and terminates.
  62. .IP \(bu
  63. \fBScripted\fR services are services which are started and stopped by executing commands (which
  64. need not actually be scripts, despite the name).
  65. Once a command completes successfully the service is considered started (or stopped, as appropriate)
  66. by Dinit.
  67. .IP \(bu
  68. \fBInternal\fR services do not run as an external process at all.
  69. They can be started and stopped without any external action.
  70. They are useful for grouping other services (via service dependencies).
  71. .IP \(bu
  72. \fBTriggered\fR services are similar to internal processes, but an external trigger is required
  73. before they will start (i.e. Dinit will not consider them as started until the trigger is issued).
  74. The \fBdinitctl trigger\fR command can be used to trigger such a service; see \fBdinitctl\fR(8).
  75. .LP
  76. Independent of their type, the state of services can be linked to other
  77. services via dependency relationships, which are discussed in the next section.
  78. .\"
  79. .SS SERVICE DEPENDENCIES
  80. .\"
  81. A service dependency relationship, broadly speaking, specifies that for one
  82. service to run, another must also be running; when starting a service Dinit will wait until
  83. dependencies are satisfied before starting any processes associated with the service.
  84. The first service is the \fIdependent\fR service and the latter is the \fIdependency\fR
  85. service (we will henceforth generally refer to the the dependency relationship as the
  86. \fIrelationship\fR and use \fIdependency\fR to refer to the service).
  87. A dependency relationship is specified via the properties of the dependent.
  88. There are different relationship types, as follows:
  89. .IP \(bu
  90. A \fBneed\fR (or "hard") relationship specifies that the dependent must wait
  91. for the dependency to be started before it starts, and that the dependency
  92. must remain started while the dependent is started.
  93. Starting the dependent will start the dependency, and stopping the dependency will stop the
  94. dependent. This type of relationship is specified using a \fBdepends-on\fR property.
  95. .IP \(bu
  96. A \fBmilestone\fR relationship specifies that the dependency must
  97. start successfully before the dependent starts.
  98. Starting the dependent will therefore start the dependency.
  99. Once started, the relationship is satisfied; if the dependency then stops, it
  100. has no effect on the dependent.
  101. However, if the dependency fails to start or has its startup cancelled, the dependent will
  102. not start (and will return to the stopped state).
  103. This type of relationship is specified using a \fBdepends-ms\fR property.
  104. .IP \(bu
  105. A \fBwaits-for\fR relationship specifies that the dependency must
  106. start successfully, or fail to start, before the dependent starts.
  107. Starting the dependent will attempt to first start the dependency, but failure will
  108. not prevent the dependent from starting.
  109. If the dependency starts, stopping it will have no effect on the dependent.
  110. This type of relationship is specified using a \fBwaits-for\fR property.
  111. .LP
  112. See the \fBSERVICE ACTIVATION MODEL\fR section in \fBdinit\fR(8) for more details of how service
  113. dependencies affect starting and stopping of services.
  114. .\"
  115. .SS SERVICE PROPERTIES
  116. .\"
  117. This section described the various service properties that can be specified
  118. in a service description file. The properties specify the type of the service,
  119. dependencies of the service, and other service configuration.
  120. .LP
  121. Each line of the file can specify a single property value, expressed as `\fIproperty-name\fR =
  122. \fIvalue\fR', or `\fIproperty-name\fR: \fIvalue\fR'.
  123. There is currently no functional difference between either form of assignment, but note that some
  124. settings will override any previous setting of the same property whereas some effectively add a
  125. new distinct property, and it is recommended to use `=' or `:' (respectively) to distinguish them.
  126. .LP
  127. A small selection of properties can have their value appended to, once set on a previous line,
  128. by specifying the property name again and using the `+=' operator in place of `=' (or `:').
  129. .LP
  130. Comments begin with a hash mark (#) and extend to the end of the line (they must be
  131. separated from setting values by at least one whitespace character).
  132. Values are interpreted literally, except that:
  133. .\"
  134. .IP \(bu
  135. White space (comprised of spaces, tabs, etc) is collapsed to a single space, except
  136. leading or trailing white space around the property value, which is stripped.
  137. .IP \(bu
  138. For settings which specify a command with arguments, the value is interpreted as a
  139. series of tokens separated by white space, rather than a single string of characters.
  140. .IP \(bu
  141. Double quotes (") can be used around all or part of a property value, to
  142. prevent whitespace collapse and prevent interpretation of other special
  143. characters (such as "#") inside the quotes.
  144. The quote characters are not considered part of the property value.
  145. White space appearing inside quotes does not act as a delimiter for tokens.
  146. .IP \(bu
  147. A backslash (\\) can be used (even inside double quotes) to escape the next character, causing it
  148. to lose any special meaning and become part of the property value (escaped newlines are an
  149. exception\(em\&they mark the end of a comment, and otherwise are treated as an unescaped space,
  150. allowing a property value to extend to the next line; in this case, the following line must begin
  151. with leading whitespace).
  152. A double backslash (\\\\) is collapsed to a single backslash within the parameter value.
  153. White space preceded by a backslash can be used to include whitespace within a token.
  154. .LP
  155. Setting a property generally overrides any previous setting (from prior lines).
  156. However some properties are set additively; these include dependency relationships and \fBoptions\fR
  157. properties.
  158. .LP
  159. Some properties that specify file paths are currently resolved (if the specified path is relative)
  160. starting from the directory containing the top-level service description file, whereas others are
  161. resolved from the directory containing the service description fragment in which the setting value
  162. is defined (a "fragment" may be the service description file itself, or it may be a file included
  163. via \fB@include\fR or similar; see \fBMETA-COMMANDS\fR). In particular, the `\-\-\-.d' settings
  164. (such as \fBwaits-for.d\fR) are resolved from the containing fragment. For all other settings, it
  165. is recommended to provide absolute paths to be robust against future changes in Dinit.
  166. .LP
  167. The following properties can be specified:
  168. .TP
  169. \fBtype\fR = {process | bgprocess | scripted | internal | triggered}
  170. Specifies the service type; see the \fBSERVICE TYPES\fR section.
  171. .TP
  172. \fBcommand\fR = \fIcommand-string\fR
  173. .TQ
  174. \fBcommand\fR += \fIcommand-string-addendum\fR
  175. Specifies the command, including command-line arguments, for starting the process.
  176. Applies only to \fBprocess\fR, \fBbgprocess\fR and \fBscripted\fR services.
  177. The value is subject to variable substitution (see \fBVARIABLE SUBSTITUTION\fR).
  178. .IP
  179. The `+=' operator can be used with this setting to append to a command set previously.
  180. .TP
  181. \fBstop\-command\fR = \fIcommand-string\fR
  182. .TQ
  183. \fBstop\-command\fR += \fIcommand-string-addendum\fR
  184. Specifies the command to stop the service (optional). Applicable to \fBprocess\fR, \fBbgprocess\fR and
  185. \fBscripted\fR services. If specified for \fBprocess\fR or \fBbgprocess\fR services, the "stop
  186. command" will be executed in order to stop the service, instead of signalling the service process.
  187. The value is subject to variable substitution (see \fBVARIABLE SUBSTITUTION\fR).
  188. .IP
  189. The `+=' operator can be used with this setting to append to a command set previously.
  190. .TP
  191. \fBworking\-dir\fR = \fIdirectory\fR
  192. Specifies the working directory for this service.
  193. For a scripted service, this affects both the start command and the stop command.
  194. The default is the directory containing the service description.
  195. The value is subject to variable substitution (see \fBVARIABLE SUBSTITUTION\fR).
  196. .TP
  197. \fBrun\-as\fR = \fIuser-id\fR
  198. Specifies which user to run the process(es) for this service as.
  199. Specify as a username or numeric ID.
  200. If specified by name, the group for the process will also be set to the primary
  201. group of the specified user, and supplementary groups will be initialised (unless support
  202. for them is disabled) according to the system's group database.
  203. If specified by number, the group for the process will remain the same as that of the
  204. running \fBdinit\fR process, and all supplementary groups will be dropped (unless support
  205. has been disabled).
  206. .TP
  207. \fBenv\-file\fR = \fIfile\fR
  208. Specifies a file containing value assignments for environment variables, in the same
  209. format recognised by the \fBdinit\fR command's \fB\-\-env\-file\fR option (see \fBdinit\fR(8)).
  210. The file is read when the service is loaded, therefore values from it can be used in variable
  211. substitutions (see \fBVARIABLE SUBSTITUTION\fR).
  212. Minimal variable substitution is performed on the \fBenv\-file\fR property value itself.
  213. If the path is not absolute, it is resolved relative to the directory containing the service
  214. description.
  215. .TP
  216. \fBrestart\fR = {yes | true | on-failure | no | false}
  217. Indicates whether the service should automatically restart if it stops, including due to
  218. unexpected process termination or a dependency stopping.
  219. Specifying \fBon-failure\fR for a \fBprocess\fR or \fBbgprocess\fR service causes the service to
  220. be restarted only when the exit status of the service process is non-zero, or if the process was
  221. terminated via a signal (other than SIGHUP, SIGINT, SIGUSR1, SIGUSR2 or SIGTERM, which indicate
  222. deliberate termination).
  223. Specifying \fBon-failure\fR for any other type of service is the same as specifying \fBfalse\fR
  224. (the service will not restart automatically).
  225. Note that if a service stops due to user request, automatic restart is inhibited.
  226. $$$changequote(`,')dnl
  227. ifelse(DEFAULT_AUTO_RESTART, ALWAYS,
  228. ``The default is to automatically restart.'',
  229. DEFAULT_AUTO_RESTART, ON_FAILURE,
  230. ``The default is to automatically restart only on process failure (\fBon-failure\fR).'',
  231. ``The default is to not automatically restart.'')
  232. changequote(`@@@',`$$$')dnl
  233. @@@.TP
  234. \fBsmooth\-recovery\fR = {yes | true | no | false}
  235. Applies only to \fBprocess\fR and \fBbgprocess\fR services.
  236. When set to true/yes, if the process terminates unexpectedly (i.e. without a stop order having been
  237. issued), an automatic process restart is performed, without first stopping any dependent services
  238. and without the service changing state.
  239. The normal restart restrictions (such as \fBrestart\-limit\-count\fR) apply.
  240. .TP
  241. \fBrestart\-delay\fR = \fIXXX.YYYY\fR
  242. Specifies the minimum time (in seconds) between automatic restarts.
  243. The default is 0.2 (200 milliseconds).
  244. .TP
  245. \fBrestart\-limit\-interval\fR = \fIXXX.YYYY\fR
  246. Sets the interval (in seconds) over which restarts are limited.
  247. If a process automatically restarts more than a certain number of times (specified by the
  248. \fBrestart-limit-count\fR setting) in this time interval, it will not be restarted again.
  249. The default value is 10 seconds.
  250. .TP
  251. \fBrestart\-limit\-count\fR = \fINNN\fR
  252. Specifies the maximum number of times that a service can automatically restart
  253. over the interval specified by \fBrestart\-limit\-interval\fR.
  254. Specify a value of 0 to disable the restart limit.
  255. The default value is 3.
  256. .TP
  257. \fBstart\-timeout\fR = \fIXXX.YYY\fR
  258. Specifies the time in seconds allowed for the service to start.
  259. If the service takes longer than this, its process group is sent a SIGINT signal
  260. and enters the "stopping" state (this may be subject to a stop timeout, as
  261. specified via \fBstop\-timeout\fR, after which the process group will be
  262. terminated via SIGKILL).
  263. The timeout period begins only when all dependencies have been satisfied.
  264. The default value is $$$DEFAULT_START_TIMEOUT@@@.
  265. A value of 0 allows unlimited start time.
  266. .TP
  267. \fBstop\-timeout\fR = \fIXXX.YYY\fR
  268. Specifies the time in seconds allowed for the service to stop.
  269. If the service takes longer than this, its process group is sent a SIGKILL signal
  270. which should cause it to terminate immediately.
  271. The timeout period begins only when all dependent services have already stopped.
  272. The default value is $$$DEFAULT_STOP_TIMEOUT@@@.
  273. A value of 0 allows unlimited stop time.
  274. .TP
  275. \fBpid\-file\fR = \fIpath-to-file\fR
  276. For \fBbgprocess\fR type services only; specifies the path of the file where
  277. daemon will write its process ID before detaching.
  278. Dinit will read the contents of this file when starting the service, once the initial process
  279. exits, and will supervise the process with the discovered process ID.
  280. Dinit may also send signals to the process ID to stop the service; if \fBdinit\fR runs as a
  281. privileged user the path should have appropriate permissions to permit abuse by untrusted
  282. unprivileged processes.
  283. .IP
  284. The value is subject to variable substitution (see \fBVARIABLE SUBSTITUTION\fR).
  285. .TP
  286. \fBdepends\-on\fR: \fIservice-name\fR
  287. This service depends on the named service.
  288. Starting this service will start the named service; the command to start this service will not be executed
  289. until the named service has started.
  290. If the named service stops then this service will also be stopped.
  291. The \fIservice-name\fR is subject to pre-load variable substitution
  292. (see \fBVARIABLE SUBSTITUTION\fR).
  293. .TP
  294. \fBdepends\-ms\fR: \fIservice-name\fR
  295. This service has a "milestone" dependency on the named service. Starting this
  296. service will start the named service; this service will not start until the
  297. named service has started, and will fail to start if the named service does
  298. not start.
  299. Once the named (dependent) service reaches the started state, however, the
  300. dependency may stop without affecting the dependent service.
  301. The name is likewise subject to pre-load variable substitution.
  302. .TP
  303. \fBwaits\-for\fR: \fIservice-name\fR
  304. When this service is started, wait for the named service to finish starting
  305. (or to fail starting) before commencing the start procedure for this service.
  306. Starting this service will automatically start the named service.
  307. If the named service fails to start, this service will start as usual (subject to
  308. other dependencies being met).
  309. The name is likewise subject to pre-load variable substitution.
  310. .TP
  311. \fBdepends\-on.d\fR: \fIdirectory-path\fR
  312. For each file name in \fIdirectory-path\fR which does not begin with a dot,
  313. add a \fBdepends-on\fR dependency to the service with the same name.
  314. Note that contents of files in the specified directory are not significant; expected
  315. usage is to have symbolic links to the associated service description files,
  316. but this is not required.
  317. Failure to read the directory contents, or to find any of the services named within,
  318. is not considered fatal.
  319. .IP
  320. The directory path, if not absolute, is relative to the directory containing the service
  321. description file.
  322. No variable substitution is done for path dependencies.
  323. .TP
  324. \fBdepends\-ms.d\fR: \fIdirectory-path\fR
  325. As for \fBdepends-on.d\fR, but with dependency type \fBdepends\-ms\fR.
  326. .TP
  327. \fBwaits\-for.d\fR: \fIdirectory-path\fR
  328. As for \fBdepends-on.d\fR, but with dependency type \fBwaits\-for\fR.
  329. .TP
  330. \fBafter\fR: \fIservice-name\fR
  331. When starting this service, if the named service is also starting, wait for the named service
  332. to finish starting before bringing this service up. This is similar to a \fBwaits\-for\fR
  333. dependency except no dependency relationship is implied; if the named service is not starting,
  334. starting this service will not cause it to start (nor wait for it in that case).
  335. It does not by itself cause the named service to be loaded (if loaded later, the "after"
  336. relationship will be enforced from that point).
  337. .IP
  338. The name is subject to pre-load variable substitution.
  339. .TP
  340. \fBbefore\fR: \fIservice-name\fR
  341. When starting the named service, if this service is also starting, wait for this service
  342. to finish starting before bringing the named service up. This is largely equivalent to specifying
  343. an \fBafter\fR relationship to this service from the named service.
  344. However, it does not by itself cause the named service to be loaded (if loaded later, the "before"
  345. relationship will be enforced from that point).
  346. .IP
  347. The name is subject to pre-load variable substitution.
  348. .TP
  349. \fBchain\-to\fR = \fIservice-name\fR
  350. When this service terminates (i.e. starts successfully, and then stops of its
  351. own accord), the named service should be started.
  352. Note that the named service is not loaded until that time; naming an invalid service will
  353. not cause this service to fail to load.
  354. .IP
  355. This can be used for a service that supplies an interactive "recovery mode"
  356. for another service; once the user exits the recovery shell, the primary
  357. service (as named via this setting) will then start.
  358. It also supports multi-stage system startup where later service description files reside on
  359. a separate filesystem that is mounted during the first stage; such service
  360. descriptions will not be found at initial start, and so cannot be started
  361. directly, but can be chained via this directive.
  362. .IP
  363. The chain is not executed if the initial service was explicitly stopped,
  364. stopped due to a dependency stopping (for any reason), if it will restart
  365. (including due to a dependent restarting), or if its process terminates
  366. abnormally or with an exit status indicating an error.
  367. However, if the \fBalways-chain\fR option is set the chain is started regardless of the
  368. reason and the status of this service termination.
  369. .IP
  370. The name is subject to pre-load variable substitution.
  371. .TP
  372. \fBsocket\-listen\fR = \fIsocket-path\fR
  373. Pre-open a socket for the service and pass it to the service using the
  374. \fBsystemd\fR activation protocol.
  375. This by itself does not give so called "socket activation", but does allow any
  376. process trying to connect to the specified socket to do so immediately after
  377. the service is started (even before the service process is properly prepared
  378. to accept connections).
  379. .IP
  380. The path value is subject to variable substitution (see \fBVARIABLE SUBSTITUTION\fR).
  381. .TP
  382. \fBsocket\-permissions\fR = \fIoctal-permissions-mask\fR
  383. Gives the permissions for the socket specified using \fBsocket\-listen\fR.
  384. Normally this will be 600 (user access only), 660 (user and group
  385. access), or 666 (all users).
  386. The default is 666.
  387. .TP
  388. \fBsocket\-uid\fR = {\fInumeric-user-id\fR | \fIusername\fR}
  389. Specifies the user (name or numeric ID) that should own the activation socket.
  390. If \fBsocket\-uid\fR is specified as a name without also specifying \fBsocket\-gid\fR, then
  391. the socket group is the primary group of the specified user (as found in the
  392. system user database, normally \fI/etc/passwd\fR).
  393. If the \fBsocket\-uid\fR setting is not provided, the socket will be owned by the user id of the \fBdinit\fR process.
  394. .TP
  395. \fBsocket\-gid\fR = {\fInumeric-group-id\fR | \fIgroup-name\fR}
  396. Specifies the group of the activation socket. See discussion of \fBsocket\-uid\fR.
  397. .TP
  398. \fBterm\-signal\fR = {\fBnone\fR | \fIsignal-name\fR}
  399. Specifies the signal to send to the process when requesting it to terminate (applies to `process'
  400. and `bgprocess' services only).
  401. Signal names are specified as the POSIX signal name without the \fBSIG\fR- prefix.
  402. At least \fBHUP\fR, \fBTERM\fR, and \fBKILL\fR are supported (use \fBdinitctl signal \-\-list\fR
  403. for the full list of supported signals).
  404. The default is TERM (the SIGTERM signal).
  405. See also the discussion of \fBstop\-timeout\fR.
  406. .TP
  407. \fBready\-notification\fR = {\fBpipefd:\fR\fIfd-number\fR | \fBpipevar:\fR\fIenv-var-name\fR}
  408. Specifies the mechanism, if any, by which a process service will notify that it is ready
  409. (successfully started).
  410. If not specified, a process service is considered started as soon as it has begun execution.
  411. The two options are:
  412. .RS
  413. .IP \(bu
  414. \fBpipefd:\fR\fIfd-number\fR \(em the service will write a message to the specified file descriptor,
  415. which \fBdinit\fR sets up as the write end of a pipe before execution.
  416. This mechanism is compatible with the S6 supervision suite.
  417. .IP \(bu
  418. \fBpipevar:\fR\fIenv-var-name\fR \(em the service will write a message to file descriptor identified
  419. using the contents of the specified environment variable, which will be set by \fBdinit\fR before
  420. execution to a file descriptor (chosen arbitrarily) attached to the write end of a pipe.
  421. .RE
  422. .TP
  423. \fBlog\-type\fR = {\fBfile\fR | \fBbuffer\fR | \fBpipe\fR | \fBnone\fR}
  424. Specifies how the output of this service is logged.
  425. This setting is valid only for process-based services (including \fBscripted\fR services).
  426. .RS
  427. .IP \(bu
  428. \fBfile\fR: output will be written to a file; see the \fBlogfile\fR setting.
  429. .IP \(bu
  430. \fBbuffer\fR: output will be buffered in memory, up to a limit specified via the
  431. \fBlog\-buffer\-size\fR setting.
  432. The buffer contents can be examined via the \fBdinitctl\fR(8) \fBcatlog\fR subcommand.
  433. .IP \(bu
  434. \fBpipe\fR: output will be written to a pipe, and may be consumed by another service
  435. (see the \fBconsumer\-of\fR setting); note that, if output is not consumed promptly, the pipe buffer
  436. may become full which may cause the service process to stall.
  437. .IP \(bu
  438. \fBnone\fR: output is discarded.
  439. .RE
  440. .IP
  441. The default log type is \fBnone\fR, but note that specifying a \fBlogfile\fR setting can change the
  442. log type to \fBfile\fR. For \fBpipe\fR (and \fBbuffer\fR, which uses a pipe internally),
  443. note that the pipe created may outlive the service process and be re-used if the service is stopped
  444. and restarted.
  445. .\"
  446. .TP
  447. \fBlogfile\fR = \fIlog-file-path\fR
  448. Specifies the log file for the service.
  449. Output from the service process (standard output and standard error streams) will be appended to this file,
  450. which will be created if it does not already exist. The file ownership and permissions are adjusted
  451. according to the \fBlogfile\-uid\fR, \fBlogfile\-gid\fR and \fBlogfile\-permissions\fR settings.
  452. This setting has no effect if the service is set to run on the console (via the \fBruns\-on\-console\fR,
  453. \fBstarts\-on\-console\fR, or \fBshares\-console\fR options).
  454. .IP
  455. The log file path is subject to variable substitution (see \fBVARIABLE SUBSTITUTION\fR).
  456. .IP
  457. Note that if the directory in which the logfile resides does not exist (or is not otherwise accessible to
  458. \fBdinit\fR) when the service is started, the service will not start successfully.
  459. .IP
  460. If this settings is specified and \fBlog\-type\fR is not specified or is currently \fBnone\fR, then
  461. the log type will be changed to \fBfile\fR.
  462. .TP
  463. \fBlogfile\-permissions\fR = \fIoctal-permissions-mask\fR
  464. Gives the permissions for the log file specified using \fBlogfile\fR. Normally this will be 600 (user access
  465. only), 640 (also readable by the group), or 644 (readable by all users).
  466. If the log file already exists when the service starts, its permissions will be changed in accordance with
  467. the value of this setting.
  468. The default is value 600 (accessible to only the owning user).
  469. .TP
  470. \fBlogfile\-uid\fR = {\fInumeric-user-id\fR | \fIusername\fR}
  471. Specifies the user (name or numeric ID) that should own the log file.
  472. If \fBlogfile\-uid\fR is specified as a name without also specifying \fBlogfile\-gid\fR, then
  473. the log file group is the primary group of the specified user (as found in the
  474. system user database, normally \fI/etc/passwd\fR).
  475. If the log file already exists when the service starts, its ownership will be changed in accordance with
  476. the value of this setting.
  477. The default value is the user id of the \fBdinit\fR process.
  478. .TP
  479. \fBlogfile\-gid\fR = {\fInumeric-group-id\fR | \fIgroup-name\fR}
  480. Specifies the group of the log file. See discussion of \fBlogfile\-uid\fR.
  481. .TP
  482. \fBlog\-buffer\-size\fR = \fIsize-in-bytes\fR
  483. If the log type (see \fBlog\-type\fR) is set to \fBbuffer\fR, this setting controls the maximum
  484. size of the buffer used to store process output. If the buffer becomes full, further output from
  485. the service process will be discarded.
  486. .TP
  487. \fBconsumer\-of\fR = \fIservice-name\fR
  488. Specifies that this service consumes (as its standard input) the output of another service.
  489. For example, this allows this service to act as a logging agent for another service.
  490. The named service must be a process-based service with \fBlog\-type\fR set to \fBpipe\fR.
  491. This setting is only valid for \fBprocess\fR and \fBbgprocess\fR services.
  492. .TP
  493. \fBoptions\fR: \fIoption\fR...
  494. Specifies various options for this service. See the \fBOPTIONS\fR section.
  495. .TP
  496. \fBload\-options\fR: \fIload_option\fR...
  497. Specifies options for interpreting other settings when loading this service description.
  498. Currently there are two available options. One is \fBexport-passwd-vars\fR, which
  499. specifies that the environment variables `\fBUSER\fR', `\fBLOGNAME\fR' (same as
  500. `\fBUSER\fR'), `\fBHOME\fR', `\fBSHELL\fR', `\fBUID\fR', and `\fBGID\fR' should
  501. be exported into the service's load environment (that is, overriding any global
  502. environment including the global environment file, but being overridable by the
  503. service's environment file). The other is \fBexport-service-name\fR, which will
  504. set the environment variable `\fBDINIT_SERVICE\fR' containing the name of the
  505. current service.
  506. .TP
  507. \fBinittab\-id\fR = \fIid-string\fR
  508. When this service is started, if this setting (or the \fBinittab\-line\fR setting) has a
  509. specified value, an entry will be created in the system "utmp" database which tracks
  510. processes and logged-in users.
  511. Typically this database is used by the "who" command to list logged-in users.
  512. The entry will be cleared when the service terminates.
  513. .IP
  514. The \fBinittab\-id\fR setting specifies the "inittab id" to be written in the entry for
  515. the process.
  516. The value is normally quite meaningless.
  517. However, it should be distinct (or unset) for separate processes.
  518. It is typically limited to a very short length.
  519. .IP
  520. The "utmp" database is mostly a historical artifact.
  521. Access to it on some systems is prone to denial-of-service by unprivileged users.
  522. It is therefore recommended that this setting not be used.
  523. However, "who" and similar utilities may not work correctly without this setting
  524. (or \fBinittab\-line\fR) enabled appropriately.
  525. .IP
  526. This setting has no effect if Dinit was not built with support for writing to the "utmp"
  527. database. It applies only to \fBprocess\fR services.
  528. .TP
  529. \fBinittab\-line\fR = \fItty-name-string\fR
  530. This specifies the tty line that will be written to the "utmp" database when this service
  531. is started.
  532. Normally, for a terminal login service, it would match the terminal device name on which
  533. the login process runs, without the "/dev/" prefix.
  534. .IP
  535. See the description of the \fBinittab\-id\fR setting for details.
  536. .TP
  537. \fBrlimit\-nofile\fR = \fIresource-limits\fR
  538. Specifies the number of file descriptors that a process may have open simultaneously.
  539. See the \fBRESOURCE LIMITS\fR section.
  540. .TP
  541. \fBrlimit\-core\fR = \fIresource-limits\fR
  542. Specifies the maximum size of the core dump file that will be generated for the process if it
  543. crashes (in a way that would result in a core dump).
  544. See the \fBRESOURCE LIMITS\fR section.
  545. .TP
  546. \fBrlimit\-data\fR = \fIresource-limits\fR
  547. Specifies the maximum size of the data segment for the process, including statically allocated
  548. data and heap allocations.
  549. Precise meaning may vary between operating systems.
  550. See the \fBRESOURCE LIMITS\fR section.
  551. .TP
  552. \fBrlimit\-addrspace\fR = \fIresource-limits\fR
  553. Specifies the maximum size of the address space of the process.
  554. See the \fBRESOURCE LIMITS\fR section.
  555. Note that some operating systems (notably, OpenBSD) do not support this limit; the
  556. setting will be ignored on such systems.
  557. .TP
  558. \fBnice\fR = \fInice-value\fR
  559. Specifies the CPU priority of the process.
  560. When the given value is out of range for the operating system, it will be clamped to
  561. supported range, but no error will be issued.
  562. On Linux, this also sets the autogroup priority, assuming procfs is mounted.
  563. .TP
  564. \fBrun\-in\-cgroup\fR = \fIcgroup-path\fR
  565. Run the service process(es) in the specified cgroup (see \fBcgroups\fR(7)).
  566. The cgroup is specified as a path; if it has a leading slash, the remainder of the path is
  567. interpreted as relative to \fI/sys/fs/cgroup\fR, and otherwise the entire path is interpreted
  568. relative to the cgroup in which \fBdinit\fR is running (as determined at startup or specified
  569. by options).
  570. The latter can only be used if there is only a single cgroup hierarchy (either the cgroups v2
  571. hierarchy with no cgroups v1 hierarchies, or a single cgroups v1 hierarchy).
  572. .IP
  573. Note that due to the "no internal processes" rule in cgroups v2, a relative path must typically
  574. begin with ".." if cgroups v2 are used.
  575. .IP
  576. The named cgroup must already exist prior to the service starting; it will not be created by
  577. \fBdinit\fR.
  578. .IP
  579. This setting is only available if \fBdinit\fR was built with cgroups support.
  580. .TP
  581. \fBcapabilities\fR = \fIiab\fR
  582. .TQ
  583. \fBcapabilities\fR += \fIiab-addendum\fR
  584. Run the service process(es) with capabilities specified by \fIiab\fR (see \fBcapabilities\fR(7)).
  585. The syntax follows the regular capabilities IAB format, with comma-separated capabilities.
  586. The append form of this setting will add to the previous IAB string, automatically adding
  587. a comma to the previous string, so you do not need to add it manually.
  588. .IP
  589. This setting is only available if \fBdinit\fR was built with capabilities support.
  590. .TP
  591. \fBsecure\-bits\fR = \fIsecbits\fR
  592. .TQ
  593. \fBsecure\-bits\fR += \fIsecbits-addendum\fR
  594. This is a companion option to \fBcapabilities\fR, specifying the secure bits for the
  595. process.
  596. Here, it is a space-separated list of keywords. The allowed keywords are \fIkeep-caps\fR,
  597. \fIno-setuid-fixup\fR, \fInoroot\fR, and variants of the three with the \fI-locked\fR
  598. suffix.
  599. The append form can be used to add more secure bits, with everything being ORed together
  600. at the end and used as an integer.
  601. .IP
  602. This setting is only available if \fBdinit\fR was built with capabilities support.
  603. .TP
  604. \fBioprio\fR = \fIioprio-value\fR
  605. Specifies the I/O priority class and value for the process.
  606. The permitted values are \fInone\fR, \fIidle\fR, \fIrealtime:PRIO\fR, and
  607. \fIbest-effort:PRIO\fR, where \fIPRIO\fR is an integer value no less than 0
  608. and no more than 7.
  609. .IP
  610. This setting is only available if \fBdinit\fR was built with ioprio support.
  611. .TP
  612. \fBoom-score-adj\fR = \fIadj-value\fR
  613. Specifies the OOM killer score adjustment for the service.
  614. The value is an integer no less than -1000 and no more than 1000.
  615. .IP
  616. This setting is only available if \fBdinit\fR was built with OOM score adjustment support.
  617. .IP
  618. This setting requires the proc filesystem to be mounted, and will result in a
  619. service startup failure if that is not the case.
  620. .\"
  621. .SS OPTIONS
  622. .\"
  623. These options are specified via the \fBoptions\fR parameter.
  624. .\"
  625. .TP
  626. \fBruns\-on\-console\fR
  627. Specifies that this service uses the console; its input and output should be
  628. directed to the console (or precisely, to the device to which \fBdinit\fR's standard
  629. output stream is connected).
  630. A service running on the console prevents other services from running on the
  631. console (they will queue for access to the console), and inhibits \fBdinit\fR's own output to it
  632. (some output will be buffered and displayed later, but some may be dropped completely).
  633. .IP
  634. Proper operation of this option (and related options) assumes that \fBdinit\fR
  635. is itself attached correctly to the console device (or a terminal, in which case
  636. that terminal will be used as the "console").
  637. .IP
  638. The \fIinterrupt\fR key (normally control-C) may be active for process / scripted
  639. services that run on the console, depending on terminal configuration and operating-system
  640. specifics.
  641. The interrupt signal (SIGINT), however, is masked by default (but see \fBunmask\-intr\fR).
  642. .TP
  643. \fBstarts\-on\-console\fR
  644. Specifies that this service uses the console during service startup.
  645. This is identical to \fBruns\-on\-console\fR except that the console will be released
  646. (available for running other services) once the service has started.
  647. It is applicable only for \fBbgprocess\fR and \fBscripted\fR services.
  648. .IP
  649. As for the \fBruns\-on\-console\fR option, the \fIinterrupt\fR key will be enabled
  650. while the service has the console.
  651. .TP
  652. \fBshares\-console\fR
  653. Specifies that this service should be given access to the console (input and output
  654. will be connected to the console), but that it should not exclusively hold the
  655. console. A service given access to the console in this way will not delay the startup of services
  656. which require exclusive access to the console (see \fBstarts\-on\-console\fR,
  657. \fBruns\-on\-console\fR) nor will it be itself delayed if such services are already running.
  658. .IP
  659. This is mutually exclusive with both \fBstarts\-on\-console\fR and \fBruns\-on\-console\fR;
  660. setting this option unsets both those options, and setting either of those options unsets
  661. this option.
  662. .TP
  663. \fBunmask\-intr\fR
  664. For services that run or start on the console, specifies that the terminal interrupt signal
  665. (SIGINT, normally invoked by control-C) should be unmasked.
  666. Handling of an interrupt is determined by the service process, but typically will
  667. cause it to terminate.
  668. This option may therefore be used to allow a service to be terminated by the user via
  669. a keypress combination.
  670. In combination with \fBskippable\fR, it may allow service startup to be skipped.
  671. .IP
  672. A service with this option will typically also have the \fBstart\-interruptible\fR option
  673. set.
  674. .IP
  675. Note that whether an interrupt can be generated, and the key combination required to do so,
  676. depends on the operating system's handling of the console device and, if it is a terminal,
  677. how the terminal is configured; see \fBstty\fR(1).
  678. .IP
  679. Note also that a process may choose to mask or unmask the interrupt signal of its own accord,
  680. once it has started.
  681. Shells, in particular, may unmask the signal; it might not be possible to reliably run a shell
  682. script on the console without allowing a user to interrupt it.
  683. .TP
  684. \fBstarts\-rwfs\fR
  685. This service mounts the root filesystem read/write (or at least mounts the
  686. normal writable filesystems for the system).
  687. This prompts Dinit to attempt to create its control socket, if it has not already managed to do so,
  688. and similarly log boot time to the system \fBwtmp\fR(5) database (if supported) if not yet done.
  689. This option may be specified on multiple services, which may be useful if the \fBwtmp\fR database becomes
  690. writable at a different stage than the control socket location becomes writable, for example.
  691. If the control socket has already been created, this option currently causes Dinit to check that
  692. the socket "file" still exists and re-create it if not. It is not recommended to rely on this
  693. behaviour.
  694. .TP
  695. \fBstarts\-log\fR
  696. This service starts the system log daemon.
  697. Dinit will begin logging via the \fI/dev/log\fR socket.
  698. .TP
  699. \fBpass\-cs\-fd\fR
  700. Pass an open Dinit control socket to the process when launching it (the
  701. \fIDINIT_CS_FD\fR environment variable will be set to the file descriptor of
  702. the socket).
  703. This allows the service to issue commands to Dinit even if the regular control socket is not available yet.
  704. .IP
  705. Using this option has security implications! The service which receives the
  706. control socket must close it before launching any untrusted processes.
  707. You should not use this option unless the service is designed to receive a Dinit
  708. control socket.
  709. .TP
  710. \fBstart\-interruptible\fR
  711. Indicates that this service can have its startup interrupted (cancelled), by sending it the SIGINT signal.
  712. If service state changes such that this service will stop, but it is currently starting, and this option
  713. is set, then Dinit will attempt to interrupt it rather than waiting for its startup to complete.
  714. This is meaningful only for \fBbgprocess\fR and \fBscripted\fR services.
  715. .TP
  716. \fBskippable\fR
  717. For scripted services, indicates that if the service startup process terminates
  718. via an interrupt signal (SIGINT), then the service should be considered started.
  719. Note that if the interrupt was issued by Dinit to cancel startup, the service
  720. will instead be considered stopped.
  721. .IP
  722. This can be combined with options such as \fBstarts\-on\-console\fR to allow
  723. skipping certain non-essential services (such as filesystem checks) using the
  724. \fIinterrupt\fR key (typically control-C).
  725. .TP
  726. \fBsignal\-process-only\fR
  727. Signal the service process only, rather than its entire process group, whenever
  728. sending it a signal for any reason.
  729. .TP
  730. \fBalways\-chain\fR
  731. Alters behaviour of the \fBchain-to\fR property, forcing the chained service to
  732. always start on termination of this service (instead of only when this service
  733. terminates with an exit status indicating success).
  734. .TP
  735. \fBkill\-all\-on\-stop\fR
  736. Before stopping this service, send a TERM signal and then (after a short pause) a
  737. KILL signal to all other processes in the system, forcibly terminating them.
  738. This option is intended to allow system shutdown scripts to run without any possible
  739. interference from "leftover" or orphaned processes (for example, unmounting file systems usually
  740. requires that the file systems are no longer in use).
  741. .IP
  742. This option must be used with care since the signal broadcast does not discriminate and
  743. potentially kills other services (or their shutdown scripts); a strict dependency ordering
  744. is suggested, i.e. every other service should either be a (possibly transitive) dependency or
  745. dependent of the service with this option set.
  746. .IP
  747. This option can be used for scripted and internal services only.
  748. .TP
  749. \fBno\-new\-privs\fR
  750. Normally, child processes can gain privileges that their parent did not have, such
  751. as setuid or setgid and file capabilities. This option can be specified to prevent
  752. the service from gaining such privileges.
  753. .IP
  754. This setting is only available if \fBdinit\fR was built with capabilities support.
  755. .\"
  756. .SS RESOURCE LIMITS
  757. .\"
  758. There are several settings for specifying process resource limits: \fBrlimit\-nofile\fR,
  759. \fBrlimit\-core\fR, \fBrlimit\-data\fR and \fBrlimit\-addrspace\fR.
  760. See the descriptions of each above.
  761. These settings place a limit on resource usage directly by the process.
  762. Note that resource limits are inherited by subprocesses, but that usage of a resource
  763. and subprocess are counted separately (in other words, a process can effectively bypass
  764. its resource limits by spawning a subprocess and allocating further resources within it).
  765. .LP
  766. Resources have both a \fIhard\fR and \fIsoft\fR limit.
  767. The soft limit is the effective limit, but note that a process can raise its soft limit up
  768. to the hard limit for any given resource.
  769. Therefore the soft limit acts more as a sanity-check; a process can exceed the soft limit
  770. only by deliberately raising it first.
  771. .LP
  772. Resource limits are specified in the following format:
  773. .sp
  774. .RS
  775. \fIsoft-limit\fR:\fIhard-limit\fR
  776. .RE
  777. .sp
  778. Either the soft limit or the hard limit can be omitted (in which case it will be unchanged).
  779. A limit can be specified as a dash, `\fB\-\fR', in which case the limit will be removed.
  780. If only one value is specified with no colon separator, it affects both the soft and hard limit.
  781. .\"
  782. .SS VARIABLE SUBSTITUTION
  783. .\"
  784. Some service properties specify a path to a file or directory, or a command line.
  785. For these properties, the specified value may contain one or more environment
  786. variable names, each preceded by a single `\fB$\fR' character, as in `\fB$NAME\fR'.
  787. In each case the value of the named environment variable will be substituted.
  788. The name must begin with a non-punctuation, non-space, non-digit character, and ends
  789. before the first control character, space, or punctuation character other than `\fB_\fR'.
  790. To avoid substitution, a single `\fB$\fR' can be escaped with a second, as in `\fB$$\fR'.
  791. .LP
  792. Variable substitution also supports a limited subset of shell syntax. You can use curly
  793. braces to enclose the variable, as in `\fB${NAME}\fR'.
  794. Limited parameter expansion is also supported, specifically the forms `\fB${NAME:\-word}\fR'
  795. (substitute `\fBword\fR' if variable is unset or empty), `\fB${NAME\-word}\fR' (substitute
  796. `\fBword\fR' if variable is unset), `\fB${NAME:+word}\fR' (substitute `\fBword\fR' if variable is
  797. set and non\-empty), and `\fB${NAME+word}\fR' (substitute `\fBword\fR' if variable is set).
  798. Unlike in shell expansion, the substituted \fBword\fR does not itself undergo expansion and
  799. cannot contain closing brace characters or whitespace, even if quoted.
  800. .LP
  801. To substitute the service argument, the `\fB$1\fR' syntax may be used.
  802. The complete syntax of the substitution is supported here.
  803. Services without an argument are treated as if the variable was unset, which
  804. affects some of the curly brace syntax variants.
  805. .LP
  806. Note that by default, command-line variable substitution occurs after splitting the line into
  807. separate arguments and so
  808. a single environment variable cannot be used to add multiple arguments to a command line.
  809. If a designated variable is not defined, it is replaced with an empty (zero-length) string, possibly producing a
  810. zero-length argument.
  811. To alter this behaviour use a slash after \fB$\fR, as in `\fB$/NAME\fR'; the expanded value will then
  812. be split into several arguments separated by whitespace or, if the value is empty or consists only
  813. of whitespace, will collapse (instead of producing an empty or whitespace argument).
  814. .LP
  815. Variable substitution occurs when the service is loaded.
  816. Therefore, it is typically not useful for dynamically changing service parameters (including
  817. command line) based on a variable that is inserted into \fBdinit\fR's environment once it is
  818. running (for example via \fBdinitctl setenv\fR).
  819. .LP
  820. The effective environment for variable substitution in setting values matches the environment supplied to the process
  821. for a service when it is launched. The priority of environment variables, from highest to lowest, for both is:
  822. .IP \(bu
  823. variables from the service \fBenv\-file\fR
  824. .IP \(bu
  825. variables set by the \fBexport\-passwd\-vars\fR and \fBexport\-service\-name\fR load options
  826. .IP \(bu
  827. the process environment of \fBdinit\fR (which is established on launch by the process environment of the
  828. parent, amended by loading the environment file (if any) as specified in \fBdinit\fR(8), and further
  829. amended via \fBdinitctl setenv\fR commands or equivalent).
  830. .LP
  831. Note that since variable substitution is performed on service load, the values seen by a service process may differ from those
  832. used for substitution, if they have been changed in the meantime.
  833. Using environment variable values in service commands and parameters can be used as means to
  834. provide easily-adjustable service configuration, but is not ideal for this purpose and alternatives
  835. should be considered.
  836. .LP
  837. In dependency fields, including \fBdepends\-on\fR as well as \fBbefore\fR/\fBafter\fR and similar,
  838. variable substitution may happen before the service environment is loaded.
  839. This "pre-load" expansion can substitute service arguments and environment variables set within
  840. dinit only; any service-specific variables that will be loaded from file (as specified using \fBenv\-file\fR)
  841. are not available.
  842. .\"
  843. .SS META-COMMANDS
  844. .\"
  845. A number of meta-commands can be used in service description files.
  846. A meta-command is indicated by an 'at' sign, \fB@\fR, at the beginning of the line (possibly preceded by whitespace).
  847. Arguments to a meta-command follow on the same line and are interpreted as for setting values.
  848. .LP
  849. The following commands are available:
  850. .TP
  851. \fB@include\fR \fIpath\fR
  852. Include the contents of another file, specified via its full path.
  853. If the specified file does not exist, an error is produced.
  854. The \fIpath\fR is subject to pre-load variable substitution
  855. (see \fBVARIABLE SUBSTITUTION\fR).
  856. .TP
  857. \fB@include\-opt\fR \fIpath\fR
  858. As for \fB@include\fR, but produces no error if the named file does not exist.
  859. .\"
  860. .SH EXAMPLES
  861. .LP
  862. Here is an example service description for the \fBmysql\fR database server.
  863. It has a dependency on the \fBrcboot\fR service (not shown) which is
  864. expected to have set up the system to a level suitable for basic operation.
  865. .sp
  866. .RS
  867. .nf
  868. .gcolor blue
  869. .ft CR
  870. # mysqld service
  871. type = process
  872. command = /usr/bin/mysqld --user=mysql
  873. logfile = /var/log/mysqld.log
  874. smooth-recovery = true
  875. restart = false
  876. depends-on: rcboot # Basic system services must be ready
  877. .ft
  878. .gcolor
  879. .RE
  880. .fi
  881. .LP
  882. Here is an examples for a filesystem check "service", run by a script
  883. (\fI/etc/dinit.d/scripts/rootfscheck.sh\fR).
  884. The script may need to reboot the system, but the control socket may not have been
  885. created, so it uses the \fBpass-cs-fd\fR option to allow the \fBreboot\fR command
  886. to issue control commands to Dinit.
  887. It runs on the console, so that output is visible and the process can be interrupted
  888. using control-C, in which case the check is skipped but dependent services continue to start.
  889. .sp
  890. .RS
  891. .nf
  892. .gcolor blue
  893. .ft CR
  894. # rootfscheck service
  895. type = scripted
  896. command = /etc/dinit.d/scripts/rootfscheck.sh
  897. restart = false
  898. options: starts-on-console pass-cs-fd
  899. options: start-interruptible skippable
  900. depends-on: early-filesystems # /proc and /dev
  901. depends-on: device-node-daemon
  902. .ft
  903. .gcolor
  904. .fi
  905. .RE
  906. .sp
  907. More examples are provided with the Dinit distribution.
  908. .\"
  909. .SH AUTHOR
  910. Dinit, and this manual, were written by Davin McCall.
  911. $$$dnl