dinitctl.8.m4 13 KB

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