dinitctl.8.m4 16 KB

  1. changequote(`@@@',`$$$')dnl
  2. @@@.TH DINITCTL "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
  3. .SH NAME
  4. dinitctl \- control services supervised by Dinit
  5. .\"
  7. .\"
  8. .PD 0
  9. .nh
  10. .HP
  11. .B dinitctl
  12. [\fIoptions\fR] \fBstart\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
  13. .HP
  14. .B dinitctl
  15. [\fIoptions\fR] \fBstop\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] [\fB\-\-ignore\-unstarted\fR] \fIservice-name\fR
  16. .HP
  17. .B dinitctl
  18. [\fIoptions\fR] \fBstatus\fR \fIservice-name\fR
  19. .HP
  20. .B dinitctl
  21. [\fIoptions\fR] \fBis\-started\fR \fIservice-name\fR
  22. .HP
  23. .B dinitctl
  24. [\fIoptions\fR] \fBis\-failed\fR \fIservice-name\fR
  25. .HP
  26. .B dinitctl
  27. [\fIoptions\fR] \fBrestart\fR [\fB\-\-no\-wait\fR] [\fB\-\-ignore\-unstarted\fR] \fIservice-name\fR
  28. .HP
  29. .B dinitctl
  30. [\fIoptions\fR] \fBwake\fR [\fB\-\-no\-wait\fR] \fIservice-name\fR
  31. .HP
  32. .B dinitctl
  33. [\fIoptions\fR] \fBrelease\fR [\fB\-\-ignore\-unstarted\fR] \fIservice-name\fR
  34. .HP
  35. .B dinitctl
  36. [\fIoptions\fR] \fBunpin\fR \fIservice-name\fR
  37. .HP
  38. .B dinitctl
  39. [\fIoptions\fR] \fBunload\fR \fIservice-name\fR
  40. .HP
  41. .B dinitctl
  42. [\fIoptions\fR] \fBreload\fR \fIservice-name\fR
  43. .HP
  44. .B dinitctl
  45. [\fIoptions\fR] \fBlist\fR
  46. .HP
  47. .B dinitctl
  48. [\fIoptions\fR] \fBshutdown\fR
  49. .HP
  50. .B dinitctl
  51. [\fIoptions\fR] \fBadd-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
  52. .HP
  53. .B dinitctl
  54. [\fIoptions\fR] \fBrm-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
  55. .HP
  56. .B dinitctl
  57. [\fIoptions\fR] \fBenable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
  58. .HP
  59. .B dinitctl
  60. [\fIoptions\fR] \fBdisable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
  61. .HP
  62. .B dinitctl
  63. [\fIoptions\fR] \fBtrigger\fR \fIservice-name\fR
  64. .HP
  65. .B dinitctl
  66. [\fIoptions\fR] \fBuntrigger\fR \fIservice-name\fR
  67. .HP
  68. .B dinitctl
  69. [\fIoptions\fR] \fBsetenv\fR [\fIname\fR[=\fIvalue\fR] \fI...\fR]
  70. .HP
  71. .B dinitctl
  72. [\fIoptions\fR] \fBcatlog\fR [\fB--clear\fR] \fIservice-name\fR
  73. .HP
  74. .B dinitctl
  75. [\fIoptions\fR] \fBsignal\fR { \fIsignal-id\fR \fIservice-name\fR | \fB\-\-list\fR | \fB-l\fR }
  76. .\"
  77. .PD
  78. .hy
  79. .\"
  81. .\"
  82. \fBdinitctl\fR is a utility to control services being managed by the
  83. \fBdinit\fR daemon.
  84. It allows starting and stopping services, and listing service status, amongst other actions.
  85. It functions by issuing commands to the daemon via a control socket.
  86. .\"
  88. .TP
  89. \fB\-\-help\fR
  90. Display brief help text and then exit.
  91. .TP
  92. \fB\-\-version\fR
  93. Display version and then exit.
  94. .TP
  95. \fB\-s\fR, \fB\-\-system\fR
  96. Control the system init process (this is the default when run as root).
  97. This option determines the default path to the control socket used to communicate with the \fBdinit\fR daemon
  98. process (it does not override the \fB\-p\fR option).
  99. .TP
  100. \fB\-u\fR, \fB\-\-user\fR
  101. Control the user init process (this is the default when not run as root).
  102. This option determines the default path to the control socket used to communicate with the \fBdinit\fR daemon process
  103. (it does not override the \fB\-p\fR option).
  104. .TP
  105. \fB\-\-socket\-path\fR \fIsocket-path\fR, \fB\-p\fR \fIsocket-path\fR
  106. Specify the path to the socket used for communicating with the service manager daemon.
  107. When not specified, the value from the \fBDINIT_SOCKET_PATH\fR environment variable is used, with
  108. the default path (as documented for \fBdinit\fR(8)) used if the variable is unset.
  109. .TP
  110. \fB\-\-use\-passed\-cfd\fR
  111. Instead of attempting to open a socket connection to the service daemon,
  112. use a pre-opened connection that has been passed to the dinitctl process from its parent
  113. via an open file descriptor.
  114. The file descriptor with the connection is identified by the contents of the DINIT_CS_FD
  115. environment variable.
  116. .TP
  117. \fB\-\-quiet\fR
  118. Suppress status output, except for errors.
  119. .TP
  120. \fB\-\-offline\fR, \fB\-o\fR
  121. Work "offline", without communicating with the \fBdinit\fR daemon.
  122. This is applicable only for the \fBenable\fR and \fBdisable\fR subcommands.
  123. .TP
  124. \fB\-\-services\-dir\fR \fIdir\fP, \fB\-d\fR \fIdir\fP
  125. Specifies \fIdir\fP as the directory containing service description files (can
  126. be given multiple times to specify multiple service directories).
  127. Default directories are not searched for services when this option is provided.
  128. This option is ignored when \fB\-\-offline\fR (\fB\-o\fR) is not also specified (otherwise,
  129. \fBdinitctl\fR can query the \fBdinit\fR daemon for the service description directories).
  130. .\"
  132. .TP
  133. \fB\-\-no\-wait\fR
  134. Do not wait for issued command to complete; exit immediately.
  135. .TP
  136. \fB\-\-pin\fR
  137. Pin the service in the requested state. The service will not leave the state until it is unpinned.
  138. .sp
  139. A service that is pinned stopped cannot be marked active, that is, start commands issued to the
  140. service have no effect.
  141. Dependents (via hard dependency relationships) of the pinned service will be unable to start.
  142. .sp
  143. A service that is pinned started cannot be stopped, however its explicit activation can be removed
  144. (eg via the \fBstop\fR or \fBrelease\fR commands).
  145. Once unpinned, a service which is not explicitly activated, and which has no active dependents,
  146. will automatically stop. If a pinned-started service fails to start, the pin is removed.
  147. .sp
  148. Note that a pin takes effect while the service is starting/stopping, before it reaches the target
  149. state. Stopping or restarting a service that is pinned started and which is already starting or
  150. started is not possible.
  151. Similarly, starting a service which is pinned stopped and which is stopping or stopped is not possible.
  152. .TP
  153. \fB\-\-force\fR
  154. Stop the service even if it will require stopping other services which depend on the specified service.
  155. When applied to the \fBrestart\fR command, this will cause the dependent services to also be restarted.
  156. .TP
  157. \fB\-\-ignore\-unstarted\fR
  158. If the service is not started or doesn't exist, ignore the command and return an exit code indicating
  159. success.
  160. .TP
  161. \fB\-\-clear\fR
  162. Clear the log buffer for the service after displaying it.
  163. .TP
  164. \fIservice-name\fR
  165. Specifies the name of the service to which the command applies.
  166. .\"
  168. .\"
  169. .TP
  170. \fBstart\fR
  171. Start the specified service.
  172. The service is marked as explicitly activated and will not be stopped automatically if its dependents stop.
  173. If the service is currently stopping it will generally continue to stop before it is then restarted.
  174. .TP
  175. \fBstop\fR
  176. Stop the specified service, and remove explicit activation.
  177. If the service has (non-soft) dependents, an error will be displayed and no further action taken,
  178. unless the \fB\-\-force\fR option is used.
  179. If the service is pinned started (and not already stopped or stopping) an error will be displayed
  180. and no further action taken.
  181. .sp
  182. The \fBrestart\fR option (see \fBdinit-service\fR(5)) applied to the stopped service will not cause the
  183. service to restart when it is stopped via this command (that is, this command inhibits automatic restart).
  184. This also applies to any dependents that must also be stopped at the same time.
  185. .sp
  186. Any pending \fBstart\fR orders (including for restarts) are cancelled,
  187. though a service which is starting will continue its startup before then stopping (unless the service is
  188. configured to have an interruptible startup or is otherwise at a stage of startup which can be safely
  189. interrupted).
  190. .TP
  191. \fBstatus\fR
  192. Give a status report on the specified service.
  193. This will show the current state (and target state, if different), and information such as process
  194. ID (pid) if applicable.
  195. If the service is stopped for any reason other than a normal stop, the reason for the service
  196. stopping will be displayed (along with any further relevant information, if available).
  197. .TP
  198. \fBis\-started\fR
  199. Check if the specified service is currently started.
  200. Any other state (including if the service is currently starting or stopping) will exit without returning success.
  201. Unless \fB\-\-quiet\fR is specified, the current service status (STOPPED, STARTING, STARTED, STOPPING)
  202. will be printed to standard output.
  203. .TP
  204. \fBis\-failed\fR
  205. Check if the specified service is currently failed.
  206. The service counts as failed if it is known it is currently stopped either because of startup
  207. failure, timeout or dependency failure.
  208. Any other state, including protocol and parse errors, will exit without returning success.
  209. Unless \fB\-\-quiet\fR is specified, the current service status (STOPPED, STARTING, STARTED, STOPPING)
  210. will be printed to standard output.
  211. .TP
  212. \fBrestart\fR
  213. Restart the specified service. The service will be stopped and then restarted, without affecting explicit
  214. activation status or dependency links from dependents.
  215. .TP
  216. \fBwake\fR
  217. Start the specified service after reattaching dependency links from all active dependents of the specified
  218. service.
  219. The service will not be marked explicitly activated, and so will stop if all the dependents stop.
  220. .TP
  221. \fBrelease\fR
  222. Clear the explicit activation mark from a service (the service will then stop if it has no active dependents).
  223. .TP
  224. \fBunpin\fR
  225. Remove start- and stop- pins from a service.
  226. If a started service is not explicitly activated and has no active dependents, it will stop.
  227. If a started service has a dependency service which is stopping, it will stop.
  228. If a stopped service has a dependent service which is starting, it will start.
  229. Otherwise, any pending start/stop commands will be carried out.
  230. .TP
  231. \fBunload\fR
  232. Completely unload a service.
  233. This can only be done if the service is stopped and has no loaded dependents (i.e. dependents must
  234. be unloaded before their dependencies).
  235. .TP
  236. \fBreload\fR
  237. Attempt to reload a service description.
  238. This is intended as a convenience for making simple changes to a service, without having to stop,
  239. remove dependencies to and unload the service. However it is not completely equivalent to doing a
  240. proper unload/reload; some altered settings may not take effect until the service is restarted,
  241. and some cannot be changed at all while the service is running.
  242. .sp
  243. In particular, the type of a running service cannot be changed; nor can the \fBinittab-id\fR, \fBinittab-line\fR,
  244. or \fBpid-file\fR settings, or the \fBruns-on-console\fR or \fBshares-console\fR flags.
  245. If any hard dependencies are added to a running service, the dependencies must already be started.
  246. .TP
  247. \fBlist\fR
  248. List loaded services and their state.
  249. Before each service, one of the following state indicators is displayed:
  250. .sp
  251. .EX
  252. \m[blue][{+}\ \ \ \ \ ]\m[]\fR \[em] service has started.
  253. \m[blue][{\ }<<\ \ \ ]\m[]\fR \[em] service is starting.
  254. \m[blue][\ \ \ <<{\ }]\m[]\fR \[em] service is starting, will stop once started.
  255. \m[blue][{\ }>>\ \ \ ]\m[]\fR \[em] service is stopping, will start once stopped.
  256. \m[blue][\ \ \ >>{\ }]\m[]\fR \[em] service is stopping.
  257. \m[blue][\ \ \ \ \ {-}]\m[]\fR \[em] service has stopped.
  258. .EE
  259. .sp
  260. The '<<' and '>>' symbols represent a transition state (starting and stopping respectively); curly braces
  261. indicate the target state (left: started, right: stopped); square brackets are used if the service
  262. is marked active (target state will always be started if this is the case).
  263. .sp
  264. An 's' in place of '+' means that the service startup was skipped (possible only if the service is
  265. configured as skippable).
  266. An 'X' in place of '-' means that the service failed to start, or that the
  267. service process unexpectedly terminated with an error status or signal while running.
  268. .sp
  269. Additional information, if available, will be printed after the service name: whether the service owns,
  270. or is waiting to acquire, the console; the process ID; the exit status or signal that caused termination.
  271. .TP
  272. \fBshutdown\fR
  273. Stop all services (without restart) and terminate Dinit.
  274. If issued to the system instance of Dinit, this will also shut down the system.
  275. .TP
  276. \fBadd-dep\fR
  277. Add a dependency between two services.
  278. The \fIdependency-type\fR must be one of \fBneed\fR, \fBmilestone\fR or \fBwaits-for\fR.
  279. Note that adding a \fBneed\fR dependency requires that the service states are consistent with the
  280. dependency (i.e. if the "from" service is started, the "to" service must also be started).
  281. Circular dependency chains may not be created.
  282. .sp
  283. (deprecated) The \fIdependency-type\fR \fBregular\fR is an old alias of \fBneed\fR.
  284. .TP
  285. \fBrm-dep\fR
  286. Remove a dependency between two services.
  287. The \fIdependency-type\fR must be one of \fBneed\fR, \fBmilestone\fR or \fBwaits-for\fR.
  288. If the "to" service is not otherwise active it may be stopped as a result of removing the dependency.
  289. .TP
  290. \fBenable\fR
  291. Persistently enable a \fBwaits-for\fR dependency between two services.
  292. This is much like \fBadd-dep\fR but it also starts the dependency if the dependent is started
  293. (without explicit activation, so the dependency will stop if the dependent stops), and it creates
  294. a symbolic link in the directory specified via the \fBwaits-for.d\fR directive in the service
  295. description (there must be only one such directive) so that the dependency will survive between
  296. sessions.
  297. .sp
  298. If the \fB--from\fR option is not used to specify the dependent, the dependency is created from the
  299. \fBboot\fR service by default.
  300. .TP
  301. \fBdisable\fR
  302. Permanently disable a \fBwaits-for\fR dependency between two services.
  303. This is the complement of the \fBenable\fR command; see the description above for more information.
  304. .sp
  305. Note that the \fBdisable\fR command affects only the dependency specified (or implied).
  306. It has no other effect, and a service that is "disabled" may still be started if it is a dependency of
  307. another started service.
  308. .TP
  309. \fBtrigger\fR
  310. Mark the specified service (which must be a \fItriggered\fR service) as having its external trigger set.
  311. This will allow the service to finish starting.
  312. .TP
  313. \fBuntrigger\fR
  314. Clear the trigger for the specified service (which must be a \fItriggered\fR service).
  315. This will delay the service from starting, until the trigger is set.
  316. If the service has already started, this will have no immediate effect.
  317. .TP
  318. \fBsetenv\fR
  319. Export one or more variables into the activation environment.
  320. The value can be provided on the command line or retrieved from the environment \fBdinitctl\fR is
  321. called in.
  322. Any subsequently started or restarted service will have these environment variables available.
  323. This is particularly useful for user services that need access to session information.
  324. .TP
  325. \fBcatlog\fR
  326. Show the contents of the log buffer for the named service.
  327. This is possible only if the log type of the service is set to \fBbuffer\fR.
  328. If the log is truncated or appears incomplete, a warning message follows the output.
  329. If the \fB\-\-clear\fR option is specified, the buffer is cleared after displaying its contents.
  330. .TP
  331. \fBsignal\fR
  332. Send a signal to the process associated with the specified service.
  333. The \fIsignal-id\fR can either be specified as an integer or signal name (standard POSIX name
  334. minus the \fBSIG\fR- prefix; a limited selection of signal names are recognised, including
  335. \fBTERM\fR, \fBHUP\fR, and \fBKILL\fR).
  336. The \fB--list\fR (\fB-l\fR) option can be used (without \fIsignal-id\fR and \fIservice-name\fR)
  337. to list the full set of supported signal names.
  338. .\"
  340. .\"
  341. Normally, services are only started if they have been explicitly activated (\fBstart\fR command) or if
  342. a started service depends on them.
  343. Therefore, starting a service also starts all services that the first depends on; stopping the
  344. same service then also stops the dependency services, unless they are also required by another
  345. explicitly activated service or have been explicitly activated themselves.
  346. .LP
  347. A service can be pinned in either the started or stopped state.
  348. This is mainly intended to be used to prevent automated stop or start of a service, including
  349. via a dependency or dependent service, during a manual administrative procedure.
  350. .LP
  351. Stopping a service manually will prevent it (and its dependents) from automatically restarting (i.e. it
  352. will override the \fBrestart\fR setting in the service configuration).
  353. .\"
  355. .\"
  356. The following environment variables may control \fBdinitctl\fR's operation:
  357. .TP
  359. The path to the socket used to communicate with the \fBdinit\fR(8) daemon. May be overridden by certain
  360. command line options. If not set, and not overridden, the \fBdinit\fR defaults are used.
  361. .\"
  362. .SH SEE ALSO
  363. \fBdinit\fR(8), \fBdinit-service\fR(5), \fB$$$SHUTDOWN_PREFIX@@@shutdown(8)\fR.
  364. .\"
  365. .SH AUTHOR
  366. Dinit, and this manual, were written by Davin McCall.
  367. $$$dnl