Python3中使用circus守护进程(Daemon,替代python2中supervisor的功能)
1、安装环境
On CentOS systems:
$ sudo yum install libzmq-dev libevent-dev python-dev python-virtualenv
2、创建环境目录
Create a virtualenv and install circus, circus-web and chaussette in it
$ virtualenv /tmp/circus
$ cd /tmp/circus
$ bin/pip install circus
$ bin/pip install circus-web
$ bin/pip install chaussette
3、进入/tmp/circus
4、创建circus.ini配置文件,并写入以下内容(本次运行的程序内容)
[watcher:myprogram]
cmd = python path/to/your/program
5、使用netstat -ano | grep 5000查看(当前pngserver.py开的是5000端口)
6、其他内容:
使用 circusctl shell 命令查看运行状态:
$ bin/circusctl
circusctl 0.7.1
circusd-stats: active
(circusctl)
7、You get into an interactive shell. Type help to get all commands:
(circusctl) help
8、参考文档
初识Circus:http://hbin.me/blog/2015/05/22/circus-tutorial/
Installing Circus:https://circus.readthedocs.io/en/latest/installation/
网友评论