start-stop-daemon.8 6.9 KB

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