start-stop-daemon.8 5.9 KB

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