天天看點

supervisor 配置與使用

1.建立配置檔案:

echo_supervisord_conf > /etc/supervisord.conf
           

2.修改配置檔案

A.添加應用

[program:listen]  //listen應用名稱
command=python /home/listen/app.py -log_file_prefix=/home/listen/log/longpoll.log
directory=/home/listen   //執行command的目錄
autorestart=true
redirect_stderr=true
           

B.打開web控制台

[inet_http_server]         ; inet (TCP) server disabled by default
port=192.168.144.168:8800       ; (ip_address:port specifier, *:port for all iface)
username=user              ; (default is no username (open server))
           

password=123

C.打開指令行控制

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
username=user              ; should be same as http_username if set
password=123                ; should be same as http_password if set
prompt=mysupervisor         ; cmd line prompt (default "supervisor")
history_file=~/.sc_history  ; use readline history if available
           

3.驗證

運作supervisord

日志/tmp/supervisord.log

[code="java"]# supervisorctl

listen RUNNING pid 8759, uptime 0:00:23

ctl中: help //檢視指令

ctl中: status //檢視狀态[/code]

通路控制台

http://192.168.144.168:8800/
           

繼續閱讀