start-stop-daemon.8 5.8 KB

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