start-stop-daemon.8 6.8 KB

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