start-stop-daemon.8 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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: unless
  67. .B \-\-pidfile
  68. is specified,
  69. .B start\-stop\-daemon
  70. behaves similar to
  71. .BR 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. \fB/proc/\fIpid\fP/exe\fR).
  89. .TP
  90. \fB\-p\fP|\fB\-\-pidfile\fP \fIpid-file\fP
  91. Check whether a process has created the file
  92. .IR pid-file .
  93. .TP
  94. \fB\-u\fP|\fB\-\-user\fP \fIusername\fP|\fIuid\fP
  95. Check for processes owned by the user specified by
  96. .I username
  97. or
  98. .IR uid .
  99. .TP
  100. \fB\-g\fP|\fB\-\-group\fP \fIgroup\fP|\fIgid\fP
  101. Change to \fIgroup\fP or \fIgid\fP when starting the process.
  102. .TP
  103. \fB\-n\fP|\fB\-\-name\fP \fIprocess-name\fP
  104. Check for processes with the name
  105. .I process-name
  106. (according to
  107. .BR /proc/\fIpid\fB/stat\fP ).
  108. .TP
  109. \fB\-s\fP|\fB\-\-signal\fP \fIsignal\fP
  110. With
  111. .BR \-\-stop ,
  112. specifies the signal to send to processes being stopped (default 15).
  113. .TP
  114. \fB\-R\fP|\fB\-\-retry\fP \fItimeout\fP|\fIschedule\fP
  115. With
  116. .BR \-\-stop ,
  117. specifies that
  118. .B start\-stop\-daemon
  119. is to check whether the process(es)
  120. do finish. It will check repeatedly whether any matching processes
  121. are running, until none are. If the processes do not exit it will
  122. then take further action as determined by the schedule.
  123. If
  124. .I timeout
  125. is specified instead of
  126. .I schedule
  127. then the schedule
  128. .IB signal / timeout /KILL/ timeout
  129. is used, where
  130. .I signal
  131. is the signal specified with
  132. .BR \-\-signal .
  133. .I schedule
  134. is a list of at least two items separated by slashes
  135. .RB ( / );
  136. each item may be
  137. .BI \- signal-number
  138. or [\fB\-\fP]\fIsignal-name\fP,
  139. which means to send that signal,
  140. or
  141. .IR timeout ,
  142. which means to wait that many seconds for processes to
  143. exit,
  144. or
  145. .BR forever ,
  146. which means to repeat the rest of the schedule forever if
  147. necessary.
  148. If the end of the schedule is reached and
  149. .BR forever
  150. is not specified, then
  151. .B start\-stop\-daemon
  152. exits with error status 2.
  153. If a schedule is specified, then any signal specified
  154. with
  155. .B \-\-signal
  156. is ignored.
  157. .TP
  158. \fB\-a\fP|\fB\-\-startas\fP \fIpathname\fP
  159. With
  160. .BR \-\-start ,
  161. start the process specified by
  162. .IR pathname .
  163. If not specified, defaults to the argument given to
  164. .BR \-\-exec .
  165. .TP
  166. .BR \-t | \-\-test
  167. Print actions that would be taken and set appropriate return value,
  168. but take no action.
  169. .TP
  170. .BR \-o | \-\-oknodo
  171. Return exit status 0 instead of 1 if no actions are (would be) taken.
  172. .TP
  173. .BR \-q | \-\-quiet
  174. Do not print informational messages; only display error messages.
  175. .TP
  176. \fB\-c\fP|\fB\-\-chuid\fP \fIusername\fR|\fIuid\fP
  177. Change to this username/uid before starting the process. You can also
  178. specify a group by appending a
  179. .BR : ,
  180. then the group or gid in the same way
  181. as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP).
  182. When using this option
  183. you must realize that the primary and supplemental groups are set as well,
  184. even if the
  185. .B \-\-group
  186. option is not specified. The
  187. .B \-\-group
  188. option is only for
  189. groups that the user isn't normally a member of (like adding per process
  190. group membership for generic users like
  191. .BR nobody ).
  192. .TP
  193. \fB\-r\fP|\fB\-\-chroot\fP \fIroot\fP
  194. Chdir and chroot to
  195. .I root
  196. before starting the process. Please note that the pidfile is also written
  197. after the chroot.
  198. .TP
  199. \fB\-d\fP|\fB\-\-chdir\fP \fIpath\fP
  200. Chdir to
  201. .I path
  202. before starting the process. This is done after the chroot if the
  203. \fB\-r\fP|\fB\-\-chroot\fP option is set. When not specified,
  204. start\-stop\-daemon will chdir to the root directory before starting
  205. the process.
  206. .TP
  207. .BR \-b | \-\-background
  208. Typically used with programs that don't detach on their own. This option
  209. will force
  210. .B start\-stop\-daemon
  211. to fork before starting the process, and force it into the background.
  212. .B WARNING: start\-stop\-daemon
  213. cannot check the exit status if the process fails to execute for
  214. .B any
  215. reason. This is a last resort, and is only meant for programs that either
  216. make no sense forking on their own, or where it's not feasible to add the
  217. code for them to do this themself.
  218. .TP
  219. \fB\-N\fP|\fB\-\-nicelevel\fP \fIint\fP
  220. This alters the priority of the process before starting it.
  221. .TP
  222. \fB\-k\fP|\fB\-\-umask\fP \fImask\fP
  223. This sets the umask of the process before starting it.
  224. .TP
  225. .BR \-m | \-\-make\-pidfile
  226. Used when starting a program that does not create its own pid file. This
  227. option will make
  228. .B start\-stop\-daemon
  229. create the file referenced with
  230. .B \-\-pidfile
  231. and place the pid into it just before executing the process. Note, the
  232. file will not be removed when stopping the program.
  233. .B NOTE:
  234. This feature may not work in all cases. Most notably when the program
  235. being executed forks from its main process. Because of this it is usually
  236. only useful when combined with the
  237. .B \-\-background
  238. option.
  239. .TP
  240. .BR \-v | \-\-verbose
  241. Print verbose informational messages.
  242. .TP
  243. .BR \-H | \-\-help
  244. Print help information; then exit.
  245. .TP
  246. .BR \-V | \-\-version
  247. Print version information; then exit.
  248. .SH AUTHORS
  249. Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl> based on
  250. a previous version by Ian Jackson <ian@chiark.greenend.org.uk>.
  251. Manual page by Klee Dienes <klee@mit.edu>, partially reformatted
  252. by Ian Jackson.