$ sudo apt-get -y install supervisor
新建一个配置文件
sudo vim /etc/supervisor/conf.d/hg_sub.conf
[program:hg_sub]
command=python /home/hg/auto_pull_push/hg_sub.py
autostart=true
stderr_logfile = /var/log/supervisor/hg_sub-err.log
stdout_logfile = /var/log/supervisor/hg_sub-stdout.log
打开控制台
$ sudo supervisorctl
更新和运行
$ supervisor > update
$ supervisor > start hg_sub.py
ps: supervisor 也可以用来管理nodejs,安装:
$ sudo npm install -g supervisor
接下来,使用supervisor 命令启动app.js:
$ sudo supervisor app.js
help_doc : http://www.cnblogs.com/aaronjs/p/3745218.html