linux 下使用supervisor管理源码启动的openerp

我与影子孤独终老i 提交于 2019-12-04 17:45:34

    从源码启动openerp,简单的做法是添加启动脚本到/etc/init.d/rc.local等,让openerp 随系统启动而运行。此类方法只在系统启动时运行,但万一程序在运行中崩溃,您可能要等到用户发现不能使用了,才去重启服务器。下面请出今天的主角: supervisor   (http://supervisord.org/)

    Supervisor 是什么?

    Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
    Supervisor 是一个客户端/服务器系统,允许用户监控和控制类 Unix 操作系统上的进程数。

1、安装

debian/ubuntu

apt-get install supervisor

redhat/centos

yum install supervisor

2、建立openerp 的配置文件

# touch /etc/supervisor/conf.d/openerp.conf
# vi /etc/supervisor/conf.d/openerp.conf

openerp.conf 内容

[program:openerp]
; openerp 启动脚本
command=python /var/www/openerp-6.1-1/openerp-server -c /var/www/openerp-6.1-1/openerp-server.conf
; openerp 目录
directory=/var/www/openerp-6.1-1/
; 是否随系统启动
autostart=true
; 自动重启
autorestart=true
; 启动时间,如果超过这个时间oe还没有挂,则视为已经启动
startsecs=3
; 启动用户
user=www-data
redirect_stderr=true
; log 文件
stdout_logfile=/var/www/openerp-6.1-1/openerp-server.log
stdout_logfile_maxbytes=500MB
stdout_logfile_backups=50
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
loglevel=warn

3、完成!重启系统试试看openerp 是否已经启动。也可以想办法把openerp 搞崩溃,试试supervisor 能不能及时将openerp 重启

4、常用命令

# supervisorctl 
openerp                          RUNNING    pid 9454, uptime 4:43:34
supervisor> start openerp  #启动
supervisor> stop openerp   #停止
supervisor> restart openerp #重启
supervisor> status openerp #查看状态

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!