start-stop-daemon.8 5.8 KB

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