docs: mention that dinitctl enable defaults to boot as dependent.
[oweals/dinit.git] / doc / manpages / dinitctl.8
1 .TH DINITCTL "8" "October 2018" "Dinit 0.4.0" "Dinit \- service management system"
2 .SH NAME
3 dinitctl \- control services supervised by Dinit
4 .\"
5 .SH SYNOPSIS
6 .\"
7 .B dinitctl
8 [\fB\-s\fR] [\fB\-\-quiet\fR] \fBstart\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
9 .br
10 .B dinitctl
11 [\fB\-s\fR] [\fB\-\-quiet\fR] \fBstop\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
12 .br
13 .B dinitctl
14 [\fB\-s\fR] [\fB\-\-quiet\fR] \fBwake\fR [\fB\-\-no\-wait\fR] \fIservice-name\fR
15 .br
16 .B dinitctl
17 [\fB\-s\fR] [\fB\-\-quiet\fR] \fBrelease\fR \fIservice-name\fR
18 .br
19 .B dinitctl
20 [\fB\-s\fR] [\fB\-\-quiet\fR] \fBunpin\fR \fIservice-name\fR
21 .br
22 .B dinitctl
23 [\fB\-s\fR] \fBunload\fR \fIservice-name\fR
24 .br
25 .B dinitctl
26 [\fB\-s\fR] \fBlist\fR
27 .br
28 .B dinitctl
29 [\fB\-s\fR] \fBshutdown\fR
30 .br
31 .B dinitctl
32 [\fB\-s\fR] \fBadd-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
33 .br
34 .B dinitctl
35 [\fB\-s\fR] \fBrm-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
36 .br
37 .B dinitctl
38 [\fB\-s\fR] \fBenable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
39 .br
40 .B dinitctl
41 [\fB\-s\fR] \fBdisable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
42 .\"
43 .SH DESCRIPTION
44 .\"
45 \fBdinitctl\fR is a utility to control services being managed by the
46 \fBdinit\fR daemon. It allows starting and stopping services, and listing
47 service status. 
48 .\"
49 .SH OPTIONS
50 .TP
51 \fB\-\-help\fR
52 display this help and exit
53 .TP
54 \fB\-\-no\-wait\fR
55 Do not wait for issued command to complete; exit immediately.
56 .TP
57 \fB\-\-pin\fR
58 Pin the service in the requested state. The service will not leave the state until it is unpinned, although
59 start/stop commands will be "remembered" while the service is pinned.
60 .TP
61 \fB\-s\fR, \fB\-\-system\fR
62 Control the system init process. The default is to control the user process. This option selects
63 the path to the control socket used to communicate with the \fBdinit\fR daemon process.
64 .TP
65 \fIservice-name\fR
66 Specifies the name of the service to which the command applies.
67 .TP
68 \fBstart\fR
69 Start the specified service. The service is marked as explicitly activated and will not be stopped
70 automatically if its dependents stop. If the service is currently stopping it will generally continue
71 to stop before it is then restarted.
72 .TP
73 \fBstop\fR
74 Stop the specified service, and remove explicit activation. The service will stop, but may restart
75 immediately if it or any dependents are configured to restart.  Any pending \fBstart\fR orders are cancelled,
76 though a service which is starting might continue its startup before then stopping.
77 .TP
78 \fBwake\fR
79 Start the specified service, but do not mark it as explicitly activated if it is not already so
80 marked.
81 .TP
82 \fBrelease\fR
83 Clear the explicit activation mark from a service (service will then stop if it has no active dependents).
84 .TP
85 \fBunpin\fR
86 Remove start- and stop- pins from a service. If a started service is not explicitly activated and
87 has no active dependents, it will stop. If a started service has a dependency service which is stopping,
88 it will stop. If a stopped service has a dependent service which is starting, it will start. Otherwise,
89 any pending start/stop commands will be carried out.
90 .TP
91 \fBunload\fR
92 Completely unload a service. This can only be done if the service is stopped and has no loaded dependents
93 (i.e. dependents must be unloaded before their dependencies).
94 .TP
95 \fBlist\fR
96 List loaded services and their state. Before each service, one of the following state indicators is
97 displayed:
98
99 .RS
100 .nf
101 \f[C]\m[blue][{+}\ \ \ \ \ ]\m[]\fR \[em] service has started.
102 \f[C]\m[blue][{\ }<<\ \ \ ]\m[]\fR \[em] service is starting.
103 \f[C]\m[blue][\ \ \ <<{\ }]\m[]\fR \[em] service is starting, will stop once started.
104 \f[C]\m[blue][{\ }>>\ \ \ ]\m[]\fR \[em] service is stopping, will start once stopped.
105 \f[C]\m[blue][\ \ \ >>{\ }]\m[]\fR \[em] service is stopping.
106 \f[C]\m[blue][\ \ \ \ \ {-}]\m[]\fR \[em] service has stopped.
107 .fi
108
109 The << and >> symbols represent a transition state (starting and stopping respectively); curly braces
110 indicate the desired state (left: started, right: stopped). An 's' in place of '+' means that service
111 startup was skipped (possible only if the service is configured as skippable). An 'X' in place of '-'
112 means that the service failed to start, or that the service process unexpectedly terminated with an
113 error status or signal while running.
114
115 Additional information, if available, will be printed after the service name: whether the service owns,
116 or is waiting to acquire, the console; the process ID; the exit status or signal that caused termination.
117 .RE
118 .TP
119 \fBshutdown\fR
120 Stop all services (without restart) and terminate Dinit. If issued to the system instance of Dinit,
121 this will also shut down the system.
122 .TP
123 \fBadd-dep\fR
124 Add a dependency between two services. The \fIdependency-type\fR must be one of \fBregular\fR,
125 \fBmilestone\fR or \fBwaits-for\fR. Note that adding a regular dependency requires that the service
126 states are consistent with the dependency (i.e. if the "from" service is started, the "to" service
127 must also be started). Circular dependency chains may not be created.
128 .TP
129 \fBrm-dep\fR
130 Remove a dependency between two services. The \fIdependency-type\fR must be one of \fBregular\fR,
131 \fBmilestone\fR or \fBwaits-for\fR. If the "to" service is not otherwise active it may be stopped
132 as a result of removing the dependency.  
133 .TP
134 \fBenable\fR
135 Permanently enable a \fBwaits-for\fR dependency between two services. This is much like \fBadd-dep\fR
136 but it also starts the dependency if the dependent is started (without explicit activation, so the
137 dependency will stop if the dependent stops), and it creates a symbolic link in the directory
138 specified via the \fBwaits-for.d\fR directive in the service description (there must be only one such
139 directive). The dependency should therefore be persistent.
140
141 If the \fB--from\fR option is not used to specify the dependent, the dependency is created from the
142 \fBboot\fR service by default.
143 .TP
144 \fBdisable\fR
145 Permanently disable a \fBwaits-for\fR dependency between two services. This is the complement of the
146 \fBenable\fR command; see the description above for more information.
147 .\"
148 .SH SERVICE OPERATION
149 .\"
150 Normally, services are only started if they have been explicitly activated (\fBstart\fR command) or if
151 a started service depends on them. Therefore, starting a service also starts all services that the first
152 depends on; stopping the same service then also stops the dependency services, unless they are also
153 required by another explicitly activated service.
154 .LP
155 A service can be pinned in either the started or stopped state. This is mainly intended to be used to
156 prevent automated stop or start of a service, including via a dependency or dependent service, during
157 a manual administrative procedure.
158 .LP
159 Stopping a service does not in general prevent it from restarting. A service configured to restart
160 automatically, or with a dependent service configured to do so, will restart immediately after stopping
161 unless pinned.
162 .\"
163 .SH SEE ALSO
164 \fBdinit\fR(8).
165 .\"
166 .SH AUTHOR
167 Dinit, and this manual, were written by Davin McCall.