-S, --start -- <argument>... start a program and pass <arguments> to it
-K, --stop stop a program
-T, --status get the program status
-H, --help print help information
-V, --version print version
Matching options (at least one is required):
--pid <pid> pid to check
--ppid <ppid> parent pid to check
-p, --pidfile <pid-file> pid file to check
-x, --exec <executable> program to start/check if it is running
-n, --name <process-name> process name to check
-u, --user <username|uid> process owner to check
Options:
-g, --group <group|gid> run process as this group
-c, --chuid <name|uid[:group|gid]>
change to this user/group before starting
process
-s, --signal <signal> signal to send (default TERM)
-a, --startas <pathname> program to start (default is <executable>)
-r, --chroot <directory> chroot to <directory> before starting
-d, --chdir <directory> change to <directory> (default is /)
-N, --nicelevel <incr> add incr to the process' nice level
-P, --procsched <policy[:prio]>
use <policy> with <prio> for the kernel
process scheduler (default prio is 0)
-I, --iosched <class[:prio]> use <class> with <prio> to set the IO
scheduler (default prio is 4)
-k, --umask <mask> change the umask to <mask> before starting
-b, --background force the process to detach
--notify-await wait for a readiness notification
--notify-timeout <int> timeout after <int> seconds of notify wait
-C, --no-close do not close any file descriptor
-m, --make-pidfile create the pidfile before starting
--remove-pidfile delete the pidfile after stopping
-R, --retry <schedule> check whether processes die, and retry
-t, --test test mode, don't do anything
-o, --oknodo exit status 0 (not 1) if nothing done
-q, --quiet be more quiet
-v, --verbose be more verbose
Retry <schedule> is <item>|/<item>/... where <item> is one of
-<signal-num>|[-]<signal-name> send that signal
<timeout> wait that many seconds
forever repeat remainder forever
or <schedule> may be just <timeout>, meaning <signal>/<timeout>/KILL/<timeout>
The process scheduler <policy> can be one of:
other, fifo or rr
The IO scheduler <class> can be one of:
real-time, best-effort or idle
Exit status:
0 = done
1 = nothing done (=> 0 if --oknodo)
2 = with --retry, processes would not die
3 = trouble
Exit status with --status:
0 = program is running
1 = program is not running and the pid file exists
3 = program is not running
4 = unable to determine status+ r8 l G& f/ I: x9 k. G+ q3 Y
5 }. y; T. @0 {) Y 0 ~ ]% I8 Q$ @, F+ t. E% i! R8 ? * p$ G3 @1 z+ d: w% Z6 |8 LNAME & g% g% W: x, X6 d4 G2 [ start-stop-daemon - start and stop system daemon programs 4 \$ ~$ [3 i y$ E: ~! r' z% c/ w+ e1 \- c: K( D) ^& q
SYNOPSIS . H& ]. V! ~3 \ ? start-stop-daemon [option...] command4 O% [0 H: |: R) k4 T) k8 K
( `% P- v- p4 x/ I% Q/ E
DESCRIPTION' `. |! q6 ]0 e$ p! X
start-stop-daemon is used to control the creation and termination of system-level processes. Using one of the matching options, start-stop-daemon can be configured to * l) f0 k3 }- [, U find existing instances of a running process.9 g, a) M- |/ W" P
7 u2 C% N6 ^ S% e Note: unless --pid or --pidfile are specified, start-stop-daemon behaves similar to killall(1). start-stop-daemon will scan the process table looking for any processes . `1 [& K* `( _4 I$ G1 \' Q which match the process name, parent pid, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processes will " |* j! n( c# Q$ Z* k& W% m+ ?# _+ \ be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have long-lived children which need to live through a & ` f; D l4 I) J: L+ V --stop, you must specify a pidfile.' O6 o% i3 w: ^9 a _, f0 I
* J' r/ A1 [0 e; }9 {
COMMANDS : Q* ?% e/ u$ B5 q9 b; `6 D ^' [5 T1 h5 u, G( v! N
1 w# V9 ]& e2 k! A
-S, --start [--] arguments * o: I% U. ?5 z$ [; O, [4 N/ [ Check for the existence of a specified process. If such a process exists, start-stop-daemon does nothing, and exits with error status 1 (0 if --oknodo is specified). If such a process does not exist, it starts an instance, using either the executable specified by --exec or, if specified, by --startas. Any arguments given after -- on the command line are passed unmodified to the program being started. 6 D' d4 U$ L e4 V# { @% ~ % k, W% {4 g* V( E6 J6 x4 [4 M( ~ -K, --stop/ x% G' L- ]0 ]" M+ M8 O
Checks for the existence of a specified process. If such a process exists, start-stop-daemon sends it the signal specified by --signal, and exits with error- j8 m5 @1 [3 z) h. x
status 0. If such a process does not exist, start-stop-daemon exits with error status 1 (0 if --oknodo is specified). If --retry is specified, then2 v5 h9 y" d, e
start-stop-daemon will check that the process(es) have terminated.6 d0 e7 B! D# e! @$ \+ z
6 ~* U/ C9 B' u! P$ f% j. C
-T, --status x. I% J7 ?# a4 L, H# Z1 x1 W
Check for the existence of a specified process, and returns an exit status code, according to the LSB Init Script Actions (since version 1.16.1). / [) F, A, q# N; g: e Q 6 Q" s' v' \) ?. q$ Q' z -H, --help 7 i8 N# B' ~9 H( ?* o4 K/ M$ K X Show usage information and exit./ i- f7 P1 t" c* M
6 I" q. P- F1 q% P -V, --version $ E6 u5 H# O: Z Show the program version and exit. 2 ~0 Y! P7 b' t. a " N- v% F9 E2 _; \6 Q3 J0 v9 s' h mOPTIONS" T F9 P, p% o( ~/ `
Matching options9 z8 I* B3 W( S1 u: e
4 Q5 w4 c9 {9 k5 z0 L7 E3 n4 T --pid pid! j. B' ^1 u& k) T: j ?; U
Check for a process with the specified pid (since version 1.17.6). The pid must be a number greater than 0. 2 R4 ?8 o; K0 a: s0 y; P. @7 }" Y' x$ E4 P: T9 B5 r# @
--ppid ppid% c4 j. }* X7 t* t( C
Check for a process with the specified parent pid ppid (since version 1.17.7). The ppid must be a number greater than 0. ! H7 `6 D: _3 p* O0 ?4 N# i. e+ \& a
-p, --pidfile pid-file& p ?+ q2 Q- Y8 e# X
Check whether a process has created the file pid-file. Note: using this matching option alone might cause unintended processes to be acted on, if the old process : e1 }1 H' y) b N0 f# ^ terminated without being able to remove the pid-file.1 i2 e8 K D) ]* ^7 @0 [
7 @9 k) v: X9 M" @8 t -x, --exec executable & h) J% N( p/ J) u; Y7 [' M1 }0 } Check for processes that are instances of this executable. The executable argument should be an absolute pathname. Note: this might not work as intended with interpreted scripts, as the executable will point to the interpreter. Take into account processes running from inside a chroot will also be matched, so other match restrictions might be needed. : n$ E/ y- l4 y0 p& a1 E$ c" s3 {2 `' A( O
-n, --name process-name 4 p+ v1 z( W( Q1 K Check for processes with the name process-name. The process-name is usually the process filename, but it could have been changed by the process itself. Note: on . k, R- E, U. y& @. t6 s; x i+ A6 k most systems this information is retrieved from the process comm name from the kernel, which tends to have a relatively short length limit (assuming more than 15 i: i( c9 z! r. C+ o) l characters is non-portable). q" A; P( [/ n0 B+ [, P9 q 1 Y( H( L- d9 S1 k" e -u, --user username|uid 6 `0 F& o; ?0 q H# s. V Check for processes owned by the user specified by username or uid. Note: using this matching option alone will cause all processes matching the user to be acted: N) [) a! L& n; K
on. 0 u& _8 p# O2 E# Q% i 4 @0 d/ y* _4 H" A6 M6 UGeneric options% Q. M( H7 y# k
-g, --group group|gid 4 z8 X( W/ z% H9 K5 G+ D Change to group or gid when starting the process./ d* g6 R# g5 k2 _$ b/ }
) f0 }6 \7 f, p- l0 y9 Z -s, --signal signal ' G' P. m) M' a! E8 g9 v With --stop, specifies the signal to send to processes being stopped (default TERM). % k! i5 a# Y+ a U* Q% a/ C, `5 M ~# {) {0 W) |
-b, --background : }% v: H9 b/ M" ^* u Typically used with programs that don't detach on their own. This option will force start-stop-daemon to fork before starting the process, and force it into the2 A# s8 n. \9 R4 X. w/ v8 b
background. Warning: start-stop-daemon cannot check the exit status if the process fails to execute for any reason. This is a last resort, and is only meant for# x: k; e) a/ z5 A# L
programs that either make no sense forking on their own, or where it's not feasible to add the code for them to do this themselves. 2 Y) E* C+ _6 Q5 N! c ; C# [1 b( {0 V) e/ M1 V; @ q -C, --no-close& t* J" C: F- b
Do not close any file descriptor when forcing the daemon into the background (since version 1.16.5). Used for debugging purposes to see the process output, or to* H* M! P- a# H. D
redirect file descriptors to log the process output. Only relevant when using --background.3 R2 i2 `) C% r; c& o$ I
2 K: V+ o4 T% y2 { -N, --nicelevel int' ?& O: k# n6 s6 [. G
This alters the priority of the process before starting it." ~; a% t0 M: n, J! O7 k
* y* F9 U+ B3 F1 j -P, --procsched policy:priority4 X6 q. ^1 R* y
This alters the process scheduler policy and priority of the process before starting it (since version 1.15.0). The priority can be optionally specified by1 }. H( D- {) j0 f( C& [
appending a : followed by the value. The default priority is 0. The currently supported policy values are other, fifo and rr. 3 |- R3 o! U, |- ~3 j3 \ \) c- D5 t9 f# d4 H' I/ Q -I, --iosched class:priority& B' k5 _0 |3 H4 z2 }" J
This alters the IO scheduler class and priority of the process before starting it (since version 1.15.0). The priority can be optionally specified by appending a 0 B. U# k3 P9 ~3 s : followed by the value. The default priority is 4, unless class is idle, then priority will always be 7. The currently supported values for class are idle, best- / |. U7 K$ z' U6 f) u9 \8 C0 z effort and real-time. ) S5 V" h5 l+ f0 F* b ( @6 P9 s, F) b. g) { l -k, --umask mask1 y3 G2 G, F% j& L k* M& D
This sets the umask of the process before starting it (since version 1.13.22). 0 r! n7 U' I- }4 V6 \ 8 Z2 c# k i" N5 l' D: [1 J! u, N -m, --make-pidfile 9 b1 f( o7 f) k Used when starting a program that does not create its own pid file. This option will make start-stop-daemon create the file referenced with --pidfile and place * M* H/ [$ N, V8 R7 N: E) a5 S the pid into it just before executing the process. Note, the file will only be removed when stopping the program if --remove-pidfile is used. Note: This feature : u8 X; T4 R4 V$ v may not work in all cases. Most notably when the program being executed forks from its main process. Because of this, it is usually only useful when combined with ' y \5 j* k* s( q the --background option. A6 t" Y6 h/ v$ X 9 z! q& h5 n" D作者: regngfpcb 时间: 2021-4-13 17:00
Linux-------start-stop-daemon