start and stop system daemon programs
用法:start-stop-daemon [options] command
--pidfile如果没有指定,start-stop-daemon 将像killall一样停止所有匹配process
name、uid等的进程。
COMMANDS:
-S, --start [--] arguments
检查特定的进程是否存在,如果存在start-stop-daemon退出并返回状态"1"
(如果设置了--oknodo,返回"0");如果不存在则由--exec或者--startas指定的
命令,所有跟在 -- 后面的参数都将传递给要启动的命令。
-K, --stop
检查特定的进程是否存在,如果存在start-stop-daemon发送一个由--signal指定
的信号并返回"0";如果不存在返回"1",如果--retry被设置,还要检查是不是进程
已经退出。
-p, --pidfile pid-file
-x, --exec executable (/proc/pid/exe)
-n, --name process-name (/proc/pid/stat)
-u, --user username|uid
OPTIONS:
-g, --group group|gid
-s, --signal signal (default TERM)
-R, --retry timeout|schedule
等待timeout的时间,检查进程是否停止,如果没有发送KILL信号;schedule可以设
置为:signal/time/KILL/time,retry后如果还存在进程将返回"2"。
-a, --startas pathname
If not specified, defaults to the argument given to --exec
-o, --oknodo
-q, --quiet
-c, -chuid username|uid 改变用户运行命令
-r, --chroot root
-d, --chdir path 启动进程前切换到目录path
-b, --background 后台运行
-k, --umask mask
-m, --make-pidfile
当命令本身不创建pidfile时,由start-stop-daemon创建;
#
用法:start-stop-daemon [options] command
--pidfile如果没有指定,start-stop-daemon 将像killall一样停止所有匹配process
name、uid等的进程。
COMMANDS:
-S, --start [--] arguments
检查特定的进程是否存在,如果存在start-stop-daemon退出并返回状态"1"
(如果设置了--oknodo,返回"0");如果不存在则由--exec或者--startas指定的
命令,所有跟在 -- 后面的参数都将传递给要启动的命令。
-K, --stop
检查特定的进程是否存在,如果存在start-stop-daemon发送一个由--signal指定
的信号并返回"0";如果不存在返回"1",如果--retry被设置,还要检查是不是进程
已经退出。
-p, --pidfile pid-file
-x, --exec executable (/proc/pid/exe)
-n, --name process-name (/proc/pid/stat)
-u, --user username|uid
OPTIONS:
-g, --group group|gid
-s, --signal signal (default TERM)
-R, --retry timeout|schedule
等待timeout的时间,检查进程是否停止,如果没有发送KILL信号;schedule可以设
置为:signal/time/KILL/time,retry后如果还存在进程将返回"2"。
-a, --startas pathname
If not specified, defaults to the argument given to --exec
-o, --oknodo
-q, --quiet
-c, -chuid username|uid 改变用户运行命令
-r, --chroot root
-d, --chdir path 启动进程前切换到目录path
-b, --background 后台运行
-k, --umask mask
-m, --make-pidfile
当命令本身不创建pidfile时,由start-stop-daemon创建;
#
注:start-stop-daemon 被/lib/lsb/init-functions使用,init-functions包含了lsb格式的预定义函数。
启动程序:
start-stop-daemon -S -x 用户命令 -- 用户参数
关闭程序:
start-stop-daemon -K -x 用户命令