start-stop-daemon.8 6.1 KB

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