Do not try to manage system (shutdown, reboot) if not running as PID 1.
[oweals/dinit.git] / doc / manpages / dinit-service.5
index 6287ebec9885995e2364c40bcbba43aede7dfccb..df7f1b404affa9a1493dbae96c7bc1630eaa3d1f 100644 (file)
@@ -1,4 +1,4 @@
-.TH DINIT-SERVICE "5" "June 2017" "Dinit 0.08" "Dinit \- service management system"
+.TH DINIT-SERVICE "5" "October 2018" "Dinit 0.4.0" "Dinit \- service management system"
 .SH NAME
 Dinit service description files
 .\"
@@ -16,8 +16,9 @@ of the file corresponds to the name of the service it describes.
 Service description files specify the various attributes of a service. A
 service description file is named after the service it represents, and is
 a plain-text file with simple key-value format. The description files are
-located in the service description directory (which defaults to
-\fI/etc/dinit.d\fR for the system process).
+located in a service description directory; by default, the system process
+searches \fI/etc/dinit.d\fR, \fI/usr/local/lib/dinit.d\fR and
+\fI/lib/dinit.d\fR, while a user process searches \fI$HOME/dinit.d\fR.
 .LP
 All services have a \fItype\fR and a set of \fIdependencies\fR. Service
 types are discussed in the following subsection. If a service depends on
@@ -165,6 +166,17 @@ Starting this service will automatically start the named service. If the
 named service fails to start, this service will start as usual (subject to
 other dependencies being met).
 .TP
+\fBwaits\-for.d\fR = \fIdirectory-path\fR
+For each file name in \fIdirectory-path\fR which does not begin with a dot,
+add a \fBwaits-for\fR dependency to the service with the same name. Note that
+contents of files in the specified directory are not significant; expected
+usage is to have symbolic links to the associated service description files,
+but this is not required. Failure to read the directory contents, or to find
+any of the services named within, is not considered fatal.
+
+The directory path, if not absolute, is relative to the directory containing
+the service description file.
+.TP
 \fBsocket\-listen\fR = \fIsocket-path\fR
 Pre-open a socket for the service and pass it to the service using the
 \fBsystemd\fR activation protocol. This by itself does not give so called
@@ -200,6 +212,15 @@ will go this file.
 .TP
 \fBoptions\fR = \fIoption\fR...
 Specifies various options for this service. See the \fBOPTIONS\fR section.
+.TP
+\fBload-options\fR = \fIload_option\fR...
+Specifies options for interpreting other settings when loading this service
+description. Currently there is only one available option, \fBsub-vars\fR,
+which specifies that command line arguments in the form of \fB$NAME\fR should
+be replaced with the contents of the environment variable with the specified
+name. Note that no word-splitting is performed and the variable value always
+becomes a single argument; if the variable is not defined, it is replaced with
+an empty (zero-length) argument.
 .\"
 .SS OPTIONS
 .\"
@@ -207,13 +228,13 @@ These options are specified via the \fBoptions\fR parameter.
 .\"
 .TP
 \fBno\-sigterm\fR
-specifies that the TERM signal should not be send to the process to terminate
+Specifies that the TERM signal should not be send to the process to terminate
 it. (Another signal can be specified using the \fBtermsignal\fR setting; if no
 other signal is specified, no signal will be sent, which usually means that
 the service will not terminate).
 .TP
 \fBruns\-on\-console\fR
-specifies that this service uses the console; its input and output should be
+Specifies that this service uses the console; its input and output should be
 directed to the console (or precisely, to the device to which Dinit's standard
 output stream is connected). A service running on the console prevents other
 services from running on the console (they will queue for the console).
@@ -223,7 +244,7 @@ services that run on the console. Handling of an interrupt is determined by
 the service process, but typically will cause it to terminate.
 .TP
 \fBstarts\-on\-console\fR
-specifies that this service uses the console during service startup. This is
+Specifies that this service uses the console during service startup. This is
 implied by \fBruns-on-console\fR, but can be specified separately for services
 that need the console while they start but not afterwards.
 
@@ -233,16 +254,16 @@ interrupting startup via the \fIinterrupt\fR key (normally control-C). This is
 useful to allow filesystem checks to be interrupted/skipped.
 .TP
 \fBstarts-rwfs\fR
-this service mounts the root filesystem read/write (or at least mounts the
+This service mounts the root filesystem read/write (or at least mounts the
 normal writable filesystems for the system). This prompts Dinit to create its
 control socket, if it has not already managed to do so.
 .TP
 \fBstarts-log\fR
-this service starts the system log daemon. Dinit will begin logging via the
+This service starts the system log daemon. Dinit will begin logging via the
 \fI/dev/log\fR socket.
 .TP
 \fBpass-cs-fd\fR
-pass an open Dinit control socket to the process when launching it (the
+Pass an open Dinit control socket to the process when launching it (the
 \fIDINIT_CS_FD\fR environment variable will be set to the file descriptor of
 the socket). This allows the service to issue commands to Dinit even if the
 regular control socket is not available yet.
@@ -253,9 +274,19 @@ should not use this option unless the service is designed to receive a Dinit
 control socket.
 .TP
 \fBstart-interruptible\fR
-this service can have its startup interrupted (cancelled) if it becomes inactive
+This service can have its startup interrupted (cancelled) if it becomes inactive
 while still starting, by sending it the SIGINT signal. This is meaningful only
 for \fBbgprocess\fR and \fBscripted\fR services.
+.TP
+\fBskippable\fR
+For scripted services, indicates that if the service startup process terminates
+via an interrupt signal (SIGINT), then the service should be considered started.
+Note that if the interrupt was issued by Dinit to cancel startup, the service
+will instead be considered stopped.
+.TP
+\fBsignal-process-only\fR
+Signal the service process only, rather than its entire process group, whenever
+sending it a signal for any reason.
 .RE
 .LP
 The next section contains example service descriptions including some of the
@@ -288,7 +319,8 @@ Here is an examples for a filesystem check "service", run by a script
 system, but the control socket may not have been created, so it uses the
 \fBpass-cs-fd\fR option to allow the \fBreboot\fR command to issue control
 commands to Dinit. It runs on the console, so that output is visible and
-the process can be interrupted using control-C.
+the process can be interrupted using control-C, in which case the check is
+skipped but dependent services continue to start.
 
 .RS
 .nf
@@ -298,7 +330,7 @@ the process can be interrupted using control-C.
 type = scripted
 command = /etc/dinit.d/rootfscheck.sh
 restart = false
-options = starts-on-console pass-cs-fd
+options = starts-on-console pass-cs-fd start-interruptible skippable
 depends-on = early-filesystems  # /proc and /dev
 depends-on = device-node-daemon
 .ft