轉貼自 http://www.lampblog.net/ubuntu/start-stop-daemon%E5%91%BD%E4%BB%A4/
1.功能作用
啟動和停止系統守護程序
2.位置
/sbin/start-stop-daemon
3.格式用法
start-stop-daemon [
4.主要參數
Commands:
-S|--start -- <argument> ... 開啟一個系統守護程序,並傳遞參數給它
-K|--stop 停止一個程序
-T|--status 得到程序的狀態
-H|--help 顯示幫助信息
-V|--version 打印版本信息
Matching options (at least one is required):
-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> 按指定用戶組權限運行程序
-c|--chuid <name|uid[:group|gid]>
按指定用戶、用戶組權限運行程序
-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> 在開始運行前設置<mask>
-b|--background 后台運行
-m|--make-pidfile 當命令本身不創建pidfile時,由start-stop-daemon創建
-R|--retry <schedule> 等待timeout的時間,檢查進程是否停止,如果沒有發送KILL信號;
-t|--test 測試模式
-o|--oknodo exit status 0 (not 1) if nothing done
-q|--quiet 不要輸出警告
-v|--verbose 顯示運行過程信息
5.應用實例
1、開啟一個daemon進程start-stop-daemon --start --background --exec /root/proxy.py
2、關閉一個daemon進程start-stop-daemon --stop --name proxy.py