| 1 |
.TH "BASELAYOUT" "13" "April 2007" "baselayout" "baselayout" |
| 2 |
.SH NAME |
| 3 |
start\-stop\-daemon \- start and stop system daemon programs |
| 4 |
.SH SYNOPSIS |
| 5 |
.B start-stop-daemon |
| 6 |
.BR -S | --start |
| 7 |
.IR options |
| 8 |
.RB [ \-\- ] |
| 9 |
.IR arguments |
| 10 |
.HP |
| 11 |
.B start-stop-daemon |
| 12 |
.BR -K | --stop |
| 13 |
.IR options |
| 14 |
.HP |
| 15 |
.B start-stop-daemon |
| 16 |
.BR -s | --signal |
| 17 |
.IR options |
| 18 |
.HP |
| 19 |
.B start-stop-daemon |
| 20 |
.BR -H | --help |
| 21 |
.HP |
| 22 |
.B start-stop-daemon |
| 23 |
.BR -V | --version |
| 24 |
.SH DESCRIPTION |
| 25 |
.B start\-stop\-daemon |
| 26 |
is used to control the creation and termination of system-level processes. |
| 27 |
Using the |
| 28 |
.BR --exec ", " --pidfile ", " --user ", and " --name " options," |
| 29 |
.B start\-stop\-daemon |
| 30 |
can be configured to find existing instances of a running process. |
| 31 |
|
| 32 |
With |
| 33 |
.BR --start , |
| 34 |
.B start\-stop\-daemon |
| 35 |
checks for the existence of a specified process. |
| 36 |
If such a process exists, |
| 37 |
.B start\-stop\-daemon |
| 38 |
does nothing, and exits with error status 1. |
| 39 |
If such a process does not exist, it starts an |
| 40 |
instance, using the executable specified by |
| 41 |
.BR --exec . |
| 42 |
Any arguments given after |
| 43 |
.BR -- |
| 44 |
on the command line are passed unmodified to the program being |
| 45 |
started. |
| 46 |
.B start\-stop\-daemon |
| 47 |
pauses for a little bit then checks the daemon is still running as badly |
| 48 |
written ones like to fork early and then bail on a error in their config. |
| 49 |
As such it may be necessary to use the --name parameter if the daemon in |
| 50 |
question is not a C program, ie a script. Once started, we store how we |
| 51 |
are called in \fBrc\fR if called from an init script. |
| 52 |
|
| 53 |
With |
| 54 |
.BR --stop , |
| 55 |
.B start\-stop\-daemon |
| 56 |
also checks for the existence of a specified process. |
| 57 |
If such a process exists, |
| 58 |
.B start\-stop\-daemon |
| 59 |
sends it the signal specified by |
| 60 |
.BR --signal , |
| 61 |
and exits with error status 0. |
| 62 |
If such a process does not exist, or there was an error stopping it |
| 63 |
.B start\-stop\-daemon |
| 64 |
exits with error status 1. If |
| 65 |
.BR --test |
| 66 |
is specified then we just send the signal and not the schedule. If |
| 67 |
.BR --oknodo |
| 68 |
is specified then we don't remove the daemon information from |
| 69 |
.BR rc. If neither |
| 70 |
.BR --test |
| 71 |
or |
| 72 |
.BR --okndo |
| 73 |
are specified then we kill signalling and waiting according to our |
| 74 |
schedule specified by |
| 75 |
.BR --retry |
| 76 |
until we timeout the process(es) exited. If we didn't timeout then |
| 77 |
we remove our daemon information from rc. |
| 78 |
|
| 79 |
With |
| 80 |
.BR --signal , |
| 81 |
.B start\-stop\-daemon |
| 82 |
also checks for the existence of a specified process. |
| 83 |
If such a process exists, |
| 84 |
.B start\-stop\-daemon |
| 85 |
sends it the signal specified and exits with error status 0. |
| 86 |
If such a process does not exist, or there was an error stopping it |
| 87 |
.B start\-stop\-daemon |
| 88 |
exits with error status 1. No futher action is taken |
| 89 |
|
| 90 |
.SH OPTIONS |
| 91 |
|
| 92 |
.TP |
| 93 |
\fB-x\fP|\fB--exec\fP \fIexecutable\fP |
| 94 |
Check for processes that are instances of this executable. |
| 95 |
.TP |
| 96 |
\fB-p\fP|\fB--pidfile\fP \fIpid-file\fP |
| 97 |
Check for processes whose process-id is specified in |
| 98 |
.I pid-file. |
| 99 |
.TP |
| 100 |
\fB-u\fP|\fB--user\fP \fIusername\fP|\fIuid\fP |
| 101 |
Check for processes owned by the user specified by |
| 102 |
.I username |
| 103 |
or |
| 104 |
.I uid. |
| 105 |
.TP |
| 106 |
\fB-n\fP|\fB--name\fP \fIprocess-name\fP |
| 107 |
Check for processes with the name |
| 108 |
.I process-name |
| 109 |
.TP |
| 110 |
\fB-s\fP|\fB--signal\fP \fIsignal\fP |
| 111 |
With |
| 112 |
.BR --stop |
| 113 |
, specifies the signal to send to processes being stopped (default SIGTERM). |
| 114 |
.TP |
| 115 |
\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIschedule\fP |
| 116 |
With |
| 117 |
.BR --stop , |
| 118 |
specifies that |
| 119 |
.B start-stop-daemon |
| 120 |
is to check whether the process(es) |
| 121 |
do finish. It will check repeatedly whether any matching processes |
| 122 |
are running, until none are. If the processes do not exit it will |
| 123 |
then take further action as determined by the schedule. |
| 124 |
|
| 125 |
If |
| 126 |
.I timeout |
| 127 |
is specified instead of |
| 128 |
.I schedule |
| 129 |
then the schedule |
| 130 |
.IB signal / timeout |
| 131 |
is used, where |
| 132 |
.I signal |
| 133 |
is the signal specified with |
| 134 |
.BR --signal . |
| 135 |
|
| 136 |
.I schedule |
| 137 |
is a list of at least two items separated by slashes |
| 138 |
.RB ( / ); |
| 139 |
each item may be |
| 140 |
.BI - signal-number |
| 141 |
or [\fB\-\fP]\fIsignal-name\fP, |
| 142 |
which means to send that signal, |
| 143 |
or |
| 144 |
.IR timeout , |
| 145 |
which means to wait that many seconds for processes to |
| 146 |
exit, |
| 147 |
or |
| 148 |
.BR forever , |
| 149 |
which means to repeat the rest of the schedule forever if |
| 150 |
necessary. |
| 151 |
|
| 152 |
If the end of the schedule is reached and |
| 153 |
.BR forever |
| 154 |
is not specified, then |
| 155 |
.B start-stop-daemon |
| 156 |
exits with error status 2. |
| 157 |
If a schedule is specified, then any signal specified |
| 158 |
with |
| 159 |
.B --signal |
| 160 |
is ignored. |
| 161 |
.TP |
| 162 |
.BR -t | --test |
| 163 |
Print actions that would be taken and set appropriate return value, |
| 164 |
but take no action. |
| 165 |
.TP |
| 166 |
.BR -o | --oknodo |
| 167 |
Used for sending signals to a running daemon but not expecting it to stop. |
| 168 |
In this version you can don't need --oknodo if you don't use --stop either. |
| 169 |
.TP |
| 170 |
.BR -q | --quiet |
| 171 |
Do not print informational messages; only display error messages. |
| 172 |
.TP |
| 173 |
\fB-c\fP|\fB--chuid\fP \fIusername\fR|\fIuid\fP |
| 174 |
Change to this username/uid before starting the process. You can also |
| 175 |
specify a group by appending a |
| 176 |
.BR : , |
| 177 |
then the group or gid in the same way |
| 178 |
as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP). |
| 179 |
When using this option |
| 180 |
you must realize that the primary and supplemental groups are set as well, |
| 181 |
even if the |
| 182 |
.B --group |
| 183 |
option is not specified. The |
| 184 |
.B --group |
| 185 |
option is only for |
| 186 |
groups that the user isn't normally a member of (like adding per/process |
| 187 |
group membership for generic users like |
| 188 |
.BR nobody ). |
| 189 |
.TP |
| 190 |
\fB-r\fP|\fB--chroot\fP \fIroot\fP |
| 191 |
Chdir and chroot to |
| 192 |
.I root |
| 193 |
before starting the process. Please note that the pidfile is also written |
| 194 |
after the chroot. |
| 195 |
.TP |
| 196 |
.BR -b | --background |
| 197 |
Typically used with programs that don't detach on their own. This option |
| 198 |
will force |
| 199 |
.B start-stop-daemon |
| 200 |
to fork before starting the process, and force it into the background. |
| 201 |
.TP |
| 202 |
\fB-1\fP|\fB--stdout\fP \fIlogfile\fP |
| 203 |
Redirect the standard output of the process to \fIlogfile\fP when started with |
| 204 |
\fB--background\fP. Must be an absolute pathname, but relative to the |
| 205 |
\fIpath\fP optionally given with \fB--chroot\fP. |
| 206 |
Hint: The \fIlogfile\fP can also be a named pipe. |
| 207 |
.TP |
| 208 |
\fB-2\fP|\fB--stderr\fP \fIlogfile\fP |
| 209 |
The same thing as \fB--stdout\fP but with the standard error output. |
| 210 |
.TP |
| 211 |
.BR -N | --nicelevel |
| 212 |
This alters the prority of the process before starting it. This can also be set |
| 213 |
by the environment variable \fBSSD_NICELEVEL\fR. |
| 214 |
.TP |
| 215 |
.BR -m | --make-pidfile |
| 216 |
Used when starting a program that does not create its own pid file. This |
| 217 |
option will make |
| 218 |
.B start-stop-daemon |
| 219 |
create the file referenced with |
| 220 |
.B --pidfile |
| 221 |
and place the pid into it just before executing the process. Note, it will |
| 222 |
not be removed when stopping the program. |
| 223 |
.B NOTE: |
| 224 |
This feature may not work in all cases. Most notably when the program |
| 225 |
being executed forks from its main process. Because of this it is usually |
| 226 |
only useful when combined with the |
| 227 |
.B --background |
| 228 |
option. |
| 229 |
.TP |
| 230 |
.BR -v | --verbose |
| 231 |
Print verbose informational messages. |
| 232 |
.TP |
| 233 |
.BR -H | --help |
| 234 |
Print help information; then exit. |
| 235 |
.TP |
| 236 |
.BR -V | --version |
| 237 |
Print version information; then exit. |