]> git.pld-linux.org Git - projects/rc-scripts.git/blame - man/start-stop-daemon.8
- created tree for manuals
[projects/rc-scripts.git] / man / start-stop-daemon.8
CommitLineData
8bff25f4
ER
1.TH START\-STOP\-DAEMON 8 "15th March 1997" "Debian Project" "dpkg utilities"
2.SH NAME
3start\-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 \-H | \-\-help
17.HP
18.B start\-stop\-daemon
19.BR \-V | \-\-version
20.SH DESCRIPTION
21.B start\-stop\-daemon
22is used to control the creation and termination of system-level processes.
23Using the
24.BR \-\-exec ", " \-\-pidfile ", " \-\-user ", and " \-\-name " options,"
25.B start\-stop\-daemon
26can be configured to find existing instances of a running process.
27
28With
29.BR \-\-start ,
30.B start\-stop\-daemon
31checks for the existence of a specified process.
32If such a process exists,
33.B start\-stop\-daemon
34does nothing, and exits with error status 1 (0 if
35.BR \-\-oknodo
36is specified).
37If such a process does not exist, it starts an
38instance, using either the executable specified by
39.BR \-\-exec ,
40(or, if specified, by
41.BR \-\-startas ).
42Any arguments given after
43.BR \-\-
44on the command line are passed unmodified to the program being
45started.
46
47With
48.BR \-\-stop ,
49.B start\-stop\-daemon
50also checks for the existence of a specified process.
51If such a process exists,
52.B start\-stop\-daemon
53sends it the signal specified by
54.BR \-\-signal ,
55and exits with error status 0.
56If such a process does not exist,
57.B start\-stop\-daemon
58exits with error status 1
59(0 if
60.BR \-\-oknodo
61is specified). If
62.B \-\-retry
63is specified then
64.B start\-stop\-daemon
65will check that the process(es) have terminated.
66
67Note that unless
68.BR \-\-pidfile ,
69is specified, then
70.B start\-stop\-daemon
71behaves similarly to
72.B killall(1).
73.B start\-stop\-daemon
74will scan the process table looking for any processes which
75match the process name, uid, and/or gid (if specified). Any
76matching process will prevent
77.BR \-\-start
78from starting the daemon. All matching processes will be
79sent the KILL signal if
80.BR \-\-stop
81is specified. For daemons which have long-lived children
82which need to live through a
83.BR \-\-stop
84you must specify a pidfile.
85
86.SH OPTIONS
87
88.TP
89\fB\-x\fP|\fB\-\-exec\fP \fIexecutable\fP
90Check for processes that are instances of this executable (according to
91.B /proc/\fIpid\fB/exe\fP
92).
93.TP
94\fB\-p\fP|\fB\-\-pidfile\fP \fIpid-file\fP
95Check whether a process has created the file
96.IR pid-file .
97.TP
98\fB\-u\fP|\fB\-\-user\fP \fIusername\fP|\fIuid\fP
99Check for processes owned by the user specified by
100.I username
101or
102.IR uid .
103.TP
104\fB\-g\fP|\fB\-\-group\fP \fIgroup\fP|\fIgid\fP
105Change to \fIgroup\fP or \fIgid\fP when starting the process.
106.TP
107\fB\-n\fP|\fB\-\-name\fP \fIprocess-name\fP
108Check for processes with the name
109.I process-name
110(according to
111.BR /proc/\fIpid\fB/stat\fP ).
112.TP
113\fB\-s\fP|\fB\-\-signal\fP \fIsignal\fP
114With
115.BR \-\-stop ,
116specifies the signal to send to processes being stopped (default 15).
117.TP
118\fB\-R\fP|\fB\-\-retry\fP \fItimeout\fP|\fIschedule\fP
119With
120.BR \-\-stop ,
121specifies that
122.B start\-stop\-daemon
123is to check whether the process(es)
124do finish. It will check repeatedly whether any matching processes
125are running, until none are. If the processes do not exit it will
126then take further action as determined by the schedule.
127
128If
129.I timeout
130is specified instead of
131.I schedule
132then the schedule
133.IB signal / timeout /KILL/ timeout
134is used, where
135.I signal
136is the signal specified with
137.BR \-\-signal .
138
139.I schedule
140is a list of at least two items separated by slashes
141.RB ( / );
142each item may be
143.BI \- signal-number
144or [\fB\-\fP]\fIsignal-name\fP,
145which means to send that signal,
146or
147.IR timeout ,
148which means to wait that many seconds for processes to
149exit,
150or
151.BR forever ,
152which means to repeat the rest of the schedule forever if
153necessary.
154
155If the end of the schedule is reached and
156.BR forever
157is not specified, then
158.B start\-stop\-daemon
159exits with error status 2.
160If a schedule is specified, then any signal specified
161with
162.B \-\-signal
163is ignored.
164.TP
165\fB\-a\fP|\fB\-\-startas\fP \fIpathname\fP
166With
167.BR \-\-start ,
168start the process specified by
169.IR pathname .
170If not specified, defaults to the argument given to
171.BR \-\-exec .
172.TP
173.BR \-t | \-\-test
174Print actions that would be taken and set appropriate return value,
175but take no action.
176.TP
177.BR \-o | \-\-oknodo
178Return exit status 0 instead of 1 if no actions are (would be) taken.
179.TP
180.BR \-q | \-\-quiet
181Do not print informational messages; only display error messages.
182.TP
183\fB\-c\fP|\fB\-\-chuid\fP \fIusername\fR|\fIuid\fP
184Change to this username/uid before starting the process. You can also
185specify a group by appending a
186.BR : ,
187then the group or gid in the same way
188as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP).
189When using this option
190you must realize that the primary and supplemental groups are set as well,
191even if the
192.B \-\-group
193option is not specified. The
194.B \-\-group
195option is only for
196groups that the user isn't normally a member of (like adding per/process
197group membership for generic users like
198.BR nobody ).
199.TP
200\fB\-r\fP|\fB\-\-chroot\fP \fIroot\fP
201Chdir and chroot to
202.I root
203before starting the process. Please note that the pidfile is also written
204after the chroot.
205.TP
206\fB\-d\fP|\fB\-\-chdir\fP \fIpath\fP
207Chdir to
208.I path
209before starting the process. This is done after the chroot if the
210\fB\-r\fP|\fB\-\-chroot\fP option is set. When not specified,
211start\-stop\-daemon will chdir to the root directory before starting
212the process.
213.TP
214.BR \-b | \-\-background
215Typically used with programs that don't detach on their own. This option
216will force
217.B start\-stop\-daemon
218to fork before starting the process, and force it into the background.
219.B WARNING: start\-stop\-daemon
220cannot check the exit status if the process fails to execute for
221.B any
222reason. This is a last resort, and is only meant for programs that either
223make no sense forking on their own, or where it's not feasible to add the
224code for it to do this itself.
225.TP
226\fB\-N\fP|\fB\-\-nicelevel\fP \fIint\fP
227This alters the prority of the process before starting it.
228.TP
229.BR \-m | \-\-make\-pidfile
230Used when starting a program that does not create its own pid file. This
231option will make
232.B start\-stop\-daemon
233create the file referenced with
234.B \-\-pidfile
235and place the pid into it just before executing the process. Note, it will
236not be removed when stopping the program.
237.B NOTE:
238This feature may not work in all cases. Most notably when the program
239being executed forks from its main process. Because of this it is usually
240only useful when combined with the
241.B \-\-background
242option.
243.TP
244.BR \-v | \-\-verbose
245Print verbose informational messages.
246.TP
247.BR \-H | \-\-help
248Print help information; then exit.
249.TP
250.BR \-V | \-\-version
251Print version information; then exit.
252
253.SH AUTHORS
254Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl> based on
255a previous version by Ian Jackson <ian@chiark.greenend.org.uk>.
256
257Manual page by Klee Dienes <klee@mit.edu>, partially reformatted
258by Ian Jackson.
This page took 0.067708 seconds and 4 git commands to generate.