Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

为openerp-server建立service



  • OS:CentOS 5.3
    Python:2.4.3

    参考openerp-web的做法



  • OS:CentOS 5.3
    Python:2.4.3

    参考openerp-web的做法



  • 在/etc/init.d下建立文件openerp-server
    如果安装了openerp-web,可将openerp-web复制过来修改
    内容大致如下:
    #!/bin/sh

    BEGIN INIT INFO

    Provides: openerp-server

    Required-Start: $syslog

    Required-Stop: $syslog

    Should-Start: $network

    Should-Stop: $network

    Default-Start: 2 3 4 5

    Default-Stop: 0 1 6

    Short-Description: OpenERP Server - the Server of the OpenERP

    Description: OpenERP is a complete ERP and CRM software.

    END INIT INFO

    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    DAEMON=/usr/bin/start-openerp-server
    NAME=openerp-server
    DESC=openerp-server

    Specify the user name (Default: terp).

    USER="openerp"

    logfile

    LOGFILE="/var/log/openerp-server.log"

    pidfile

    PIDFILE=/var/run/$NAME.pid

    Additional options that are passed to the Daemon.

    DAEMON_OPTS="--logfile $LOGFILE"

    [ -x $DAEMON ] || exit 0
    [ -f $CONFIGFILE ] || exit 0

    checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=cat $PIDFILE
    [ -d /proc/$pid ] && return 0
    return 1
    }

    do_start() {
    $DAEMON $DAEMON_OPTS > /dev/null 2>&1 &

    RETVAL=$?
    sleep 5         # wait for few seconds
    
    echo $! > $PIDFILE  # create pidfile
    
    return $RETVAL
    

    }

    do_stop() {

    pid=`cat $PIDFILE`
    kill -15 $pid
    
    RETVAL=$?
    sleep 2         # wait for few seconds
    rm -f $PIDFILE  # remove pidfile
    
    return $RETVAL
    

    }

    do_restart() {

    if [ -f $PIDFILE ]; then
        do_stop
    fi
    
    do_start
    
    return $?
    

    }

    start_daemon() {

    if [ -f $PIDFILE ]; then
        echo "pidfile already exists: $PIDFILE"
        exit 1
    fi
    
    echo -n "Starting $DESC: "
    
    do_start
    
    checkpid
    
    if [ $? -eq 1 ]; then
        rm -f $PIDFILE
        echo "failed."
        exit 1
    fi
    
    echo "done."
    

    }

    stop_daemon() {

    checkpid
    
    if [ $? -eq 1 ]; then
        exit 0
    fi
    
    echo -n "Stopping $DESC: "
    
    do_stop
    
    if [ $? -eq 1 ]; then
        echo "failed."
        exit 1
    fi
    
    echo "done."
    

    }

    restart_daemon() {

    echo -n "Reloading $DESC: "
    
    do_restart
    
    checkpid
    
    if [ $? -eq 1 ]; then
        rm -f $PIDFILE
        echo "failed."
        exit 1
    fi
    
    echo "done."
    

    }

    status_daemon() {

    echo -n "Checking $DESC: "
    
    checkpid
    
    if [ $? -eq 1 ]; then
        echo "stopped."
    else
        echo "running."
    fi
    

    }

    case "$1" in
    start) start_daemon ;;
    stop) stop_daemon ;;
    restart|force-reload) restart_daemon ;;
    status) status_daemon ;;
    *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
    exit 1
    ;;
    esac

    exit 0

    vim: sts=4 st=4 et



  • 补充一点,我这里是将 /usr/bin/openerp-server改名成了 start-openerp-server



  • touch /var/log/openerp-server.log

    chown openerp /var/log/openerp-server.log

    启动服务:
    #/etc/init.d/openerp-server start
    关闭服务:
    #/etc/init.d/openerp-server stop

    [[i] 本帖最后由 iplan 于 2009-6-22 14:49 编辑 [/i]]



  • 好贴啊!郁闷的是我是在虚拟主机上装的,没权限在etc目录下操作。哎...有人在虚拟主机上安装成功的,来讲讲杂样配置服务器和web啊!


登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待