start-stop-daemon.8 6.9 KB

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