1、安裝html
//直接使用pip安裝(pip的安裝 http://www.cnblogs.com/yxhblogs/p/8971251.html) pip install supervisor
2、配置ide
//運行echo_supervisord_conf 命令重定向到一個配置文件 echo_supervisord_conf > /etc/supervisord.conf
3、修改配置文件ui
//建立一個目錄 mkdir /etc/supervisor.d //把/etc/supervisord.conf 裏 include 部分的的配置修改一下,改成以下: [include] files = /etc/supervisor.d/*.conf
4、program 配置this
[root@localhost supervisord.d]# cat test.conf ;[program:theprogramname] ;command=/bin/cat ; the program (relative uses PATH, can take args) //啓動命令,與手動在命令行啓動的命令是同樣的 ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) ;numprocs=1 ; number of processes copies to start (def 1) ;directory=/var/tmp ; directory to cwd to before exec (def no cwd) //程序的啓動目錄 ;umask=022 ; umask for process (default None) ;priority=999 ; the relative start priority (default 999) ;autostart=true ; start at supervisord start (default: true) //在 supervisord 啓動的時候也自動啓動 ;startsecs=1 ; # of secs prog must stay up to be running (def. 1) //啓動 1 秒後沒有異常退出,就看成已經正常啓動了 ;startretries=3 ; max # of serial start failures when starting (default 3) //啓動失敗自動重試次數,默認是 3 ;autorestart=unexpected ; when to restart if exited after running (def: unexpected) ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2) ;stopsignal=QUIT ; signal used to kill process (default TERM) ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) ;stopasgroup=false ; send stop signal to the UNIX process group (default false) ;killasgroup=false ; SIGKILL the UNIX process group (def false) ;user=chrism ; setuid to this UNIX account to run the program //用哪一個用戶啓動 ;redirect_stderr=true ; redirect proc stderr to stdout (default false) //把 stderr 重定向到 stdout,默認 false ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) //stdout 日誌文件大小,默認 50MB ;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10) //stdout 日誌文件備份數 , 默認10 ;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) ;stdout_events_enabled=false ; emit events on stdout writes (default false) ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10) ;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) ;stderr_events_enabled=false ; emit events on stderr writes (default false) ;environment=A="1",B="2" ; process environment additions (def no adds) ;serverurl=AUTO ; override serverurl computation (childutils) 更詳細配置請參考:https://blog.csdn.net/chenyulancn/article/details/52789565
5、啓動url
//啓動supervisor supervisord -c /etc/supervisord.conf