紧急求助:设置openerp-web自启动出现问题
-
在openerp-web的安装目录下有一个script的目录,那里有现成的设置daemon的脚本,你可以试试
-
我用启动光盘进入控制台,删除启动文件,现在已经可以进入系统了,但是对于openerp-web设置自启动的问题,还是想要解决哦,openerp-web我只找到了在/usr/local/bin下有一个openerp-web。没找到他的安装目录,在/usr/local/lib/python2.6/dist-packages/openerp_web-6.0.2-py2.6.egg目录下,没有scripts目录,只有addons,doc,egg-info,openobjects这几个目录
我安装的是openerp-web-6.0.2.tar.gz,请问装完后,安装目录应该在哪里呢?
谢谢! -
将下面的代码保存为openerp-web,添加运行权限,更改USER变量, 放到/etc/init.d目录下,
<br />#!/bin/sh<br /><br />### BEGIN INIT INFO<br /># Provides: openerp-web<br /># Required-Start: $syslog<br /># Required-Stop: $syslog<br /># Should-Start: $network<br /># Should-Stop: $network<br /># Default-Start: 2 3 4 5<br /># Default-Stop: 0 1 6<br /># Short-Description: OpenERP Web - the Web Client of the OpenERP<br /># Description: OpenERP is a complete ERP and CRM software.<br />### END INIT INFO<br /><br />PATH=/sbin:/bin:/usr/sbin:/usr/bin<br />DAEMON=/usr/bin/openerp-web<br />NAME=openerp-web<br />DESC=openerp-web<br /><br /># Specify the user name (Default: openerp).<br />USER="openerp"<br /><br /># Specify an alternate config file (Default: /etc/openerp-web.cfg).<br />CONFIGFILE="/etc/openerp-web.cfg"<br /><br /># pidfile<br />PIDFILE=/var/run/$NAME.pid<br /><br /># Additional options that are passed to the Daemon.<br />DAEMON_OPTS="-c $CONFIGFILE"<br /><br />[ -x $DAEMON ] || exit 0<br />[ -f $CONFIGFILE ] || exit 0<br /><br />checkpid() {<br /> [ -f $PIDFILE ] || return 1<br /> pid=`cat $PIDFILE`<br /> [ -d /proc/$pid ] && return 0<br /> return 1<br />}<br /><br />if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then<br /><br /> do_start() {<br /> start-stop-daemon --start --quiet --pidfile $PIDFILE \<br /> --chuid $USER --background --make-pidfile \<br /> --exec $DAEMON -- $DAEMON_OPTS<br /> <br /> RETVAL=$?<br /> sleep 5 # wait for few seconds<br /><br /> return $RETVAL<br /> }<br /><br /> do_stop() {<br /> start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo<br /><br /> RETVAL=$?<br /> sleep 2 # wait for few seconds<br /> rm -f $PIDFILE # remove pidfile<br /><br /> return $RETVAL<br /> }<br /><br /> do_restart() {<br /> start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo<br /><br /> sleep 2 # wait for few seconds<br /> rm -f $PIDFILE # remove pidfile<br /><br /> start-stop-daemon --start --quiet --pidfile $PIDFILE \<br /> --chuid $USER --background --make-pidfile \<br /> --exec $DAEMON -- $DAEMON_OPTS<br /><br /> RETVAL=$?<br /> sleep 5 # wait for few seconds<br /><br /> return $RETVAL<br /> }<br /><br />else<br /> <br /> do_start() {<br /> $DAEMON $DAEMON_OPTS > /dev/null 2>&1 &<br /> <br /> RETVAL=$?<br /> sleep 5 # wait for few seconds<br /><br /> echo $! > $PIDFILE # create pidfile<br /><br /> return $RETVAL<br /> }<br /><br /> do_stop() {<br /><br /> pid=`cat $PIDFILE`<br /> kill -15 $pid<br /><br /> RETVAL=$?<br /> sleep 2 # wait for few seconds<br /> rm -f $PIDFILE # remove pidfile<br /><br /> return $RETVAL<br /> }<br /><br /> do_restart() {<br /><br /> if [ -f $PIDFILE ]; then<br /> do_stop<br /> fi<br /><br /> do_start<br /><br /> return $?<br /> }<br /><br />fi<br /><br />start_daemon() {<br /><br /> if [ -f $PIDFILE ]; then<br /> echo "pidfile already exists: $PIDFILE"<br /> exit 1<br /> fi<br /><br /> echo -n "Starting $DESC: "<br /><br /> do_start<br /><br /> checkpid<br /><br /> if [ $? -eq 1 ]; then <br /> rm -f $PIDFILE<br /> echo "failed."<br /> exit 1<br /> fi<br /><br /> echo "done."<br />}<br /><br />stop_daemon() {<br /><br /> checkpid<br /><br /> if [ $? -eq 1 ]; then<br /> exit 0<br /> fi<br /><br /> echo -n "Stopping $DESC: "<br /><br /> do_stop<br /><br /> if [ $? -eq 1 ]; then<br /> echo "failed."<br /> exit 1<br /> fi<br /><br /> echo "done."<br />}<br /><br />restart_daemon() {<br /><br /> echo -n "Reloading $DESC: "<br /><br /> do_restart<br /><br /> checkpid<br /><br /> if [ $? -eq 1 ]; then <br /> rm -f $PIDFILE<br /> echo "failed."<br /> exit 1<br /> fi<br /><br /> echo "done."<br />}<br /><br />status_daemon() {<br /><br /> echo -n "Checking $DESC: "<br /><br /> checkpid<br /><br /> if [ $? -eq 1 ]; then<br /> echo "stopped."<br /> else<br /> echo "running."<br /> fi<br />}<br /><br />case "$1" in<br /> start) start_daemon ;;<br /> stop) stop_daemon ;;<br /> restart|force-reload) restart_daemon ;;<br /> status) status_daemon ;;<br /> *)<br /> N=/etc/init.d/$NAME<br /> echo "Usage: $N {start|stop|restart|force-reload|status}" >&2<br /> exit 1<br /> ;;<br />esac<br /><br />exit 0<br /><br /># vim: sts=4 st=4 et<br /><br />
将下面的脚本保存为openerp-web,添加运行权限,放到/usr/bin目录下#!/usr/bin/env python<br />import sys<br /><br />from openobject.commands import start, ConfigurationError<br /><br />if __name__ == "__main__":<br /> try:<br /> start()<br /> except ConfigurationError, exc:<br /> sys.stderr.write(str(exc)+"\n")<br /> sys.exit(1)<br />