????program ????
????????????????? supervisrod ???????????????????????????????????????????????????????????д?? supervisord.conf ????????????????????????????? include ??????????????飩д????????????????
???????????????????????? /etc/supervisor/ ????????Щ????????????????? /etc/supervisord.conf ?? include ???????????????£?
????[include]
????files = /etc/supervisor/*.conf
?????????и??? Python ?? Flask ????д???????????????? usercenter???? gunicorn (http://gunicorn.org/) ?? web ???????????????λ?? /home/leon/projects/usercenter??gunicorn ????????gunicorn.py??WSGI callable ?? wsgi.py ??? app ????????????????????????????????????????
????cd /home/leon/projects/usercenter
????gunicorn -c gunicorn.py wsgi:app
?????????д???????????????????????????????? supervisord ???????gunicorn ?? daemon ??????????? False????
[program:usercenter]
directory = /home/leon/projects/usercenter ; ??????????
command = gunicorn -c gunicorn.py wsgi:app  ; ???????????????????????????????????????????
autostart = true     ; ?? supervisord ???????????????
startsecs = 5        ; ??? 5 ?????????????????????????????
autorestart = true   ; ??????????????????
startretries = 3     ; ??????????????????????? 3
user = leon          ; ???????????
redirect_stderr = true  ; ?? stderr ????? stdout????? false
stdout_logfile_maxbytes = 20MB  ; stdout ????????С????? 50MB
stdout_logfile_backups = 20     ; stdout ????????????
; stdout ????????????????????????????????????????????????????????supervisord ?????????????????
stdout_logfile = /data/logs/usercenter_stdout.log
; ??????? environment ????????????????????????????÷?????? PYTHONPATH
; environment=PYTHONPATH=$PYTHONPATH:/path/to/somewhere
???????????????????????? [program:x] ???????????????? supervisord ???????????????[program:x] ???е? x ??? program name???????????supervisorctl ?? web ???棩??????? supervisorctl ??????????????????? start??restart??stop ???????
??????? supervisorctl
????Supervisorctl ?? supervisord ??????????п???????????????????? supervisord ?????????????????????? supervisord ??????????????????????
????supervisorctl -c /etc/supervisord.conf
??????????????????? supervisorctl ?? shell ???棬????????в???????????
????> status    # ????????
????> stop usercenter   # ??? usercenter ????
????> start usercenter  # ??? usercenter ????
????> restart usercenter    # ???? usercenter ????
????> reread    ?? ????и??£?????????????????????????????????
????> update    ?? ????????????????????
??????????Щ??????????????????????? supervisorctl ?? shell ???棬?????????? bash ??????У?
$ supervisorctl status
$ supervisorctl stop usercenter
$ supervisorctl start usercenter
$ supervisorctl restart usercenter
$ supervisorctl reread
$ supervisorctl update
????????
???????? supervisorctl ????????????? supervisrod ??? web ??????棬??? web ?????? Basic Auth ????????????????
?????????????????????????????? group?????з???????
?????????????????????? supervisord ?????????? pragram ?????????????? crash ????????????????????? stderr????????????????????????????
???????????????????????????????logstash
cd /etc/supervisord.d
vim logstash.conf
[program:logstash]
command=/opt/logstash/bin/logstash -f /opt/logstash/conf/zabbix.conf -l /opt/logstash/logs/zabbix.log
numprocs=1
autostart=true
autorestart=true
log_stdout=true
log_stderr=true