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

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

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

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

紧急求助:设置openerp-web自启动出现问题



  • openerp已经安装完成,启动目前也没有问题,想将openerp-web设置为开机自启动,和openerp-server一样(用deb包安装的)。我按照论坛中的帖子,使用的是如下的步骤:
    sudo cp /usr/local/bin/openerp-web /etc/init.d/
    sudo cp /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.2-py2.6.egg/doc/openerp-web.cfg /etc/openerp-web.cfg
    这两个文件cp过去后,继续:
    sudo chmod +x /etc/init.d/openerp-web
    sudo update-rc.d openerp-web defaults
    然后重启系统,结果在openerp-server和postgresql启动后,还没有进入控制台(我装的是server),web就启动了,而且无法退出……我的意思是,在系统启动的过程中,我能看到openerp-web的启动信息,就像在一个控制台窗口中一样,由于直接是字符界面,不像图形界面中可以关闭控制台窗口,所以导致根本无法进入系统。
    用ctrl+alt+del,想重启机器,结果又出现了openerp-web的启动信息,系统停滞,无法重启,只能按电源键重启。
    请帮忙看看这个问题应该如何解决呢?我设置openerp-web自启动的方式是否不正确?应该如何设置呢?
    谢谢!



  • 您不会用linux啊
    ctrl+alt+F2
    整个世界安静了



  • 不推荐直接在 console 上操作...
    我一般最小化安装 Ubuntu 后.会首先装上 sshd  server, 然后 在外面用 ssh client 连进去操作.



  • ctrl+alt+F2,是进入console吧,我没装图形界面,我试试这个功能。
    不过目前我想知道我设置openerp-web自启动的方式正确吗?因为现在这样,连接数据库的时候是出错的,说明server并没有完全启动,web启动后阻止了其他进程的启动。
    所以我现在想知道的是,为何web没有像server一样是后台启动,而是前台启动呢?
    谢谢



  • 下载了一个sysv-rc-conf ,结果设置错了,把openerp-web设置成S了,结果现在连root都进不去了,就卡死在openerp-web的启动那里。请问openerp-web装完后,他的启动文件是在/usr/local/bin/openerp-web这里吗,这个文件需要修改吗?如何才能让他和openerp-server一样启动?
    谢谢


  • 管理员

    在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:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  openerp-web<br /># Required-Start:&nbsp; &nbsp; &nbsp;  $syslog<br /># Required-Stop:&nbsp; &nbsp; &nbsp; &nbsp; $syslog<br /># Should-Start:&nbsp; &nbsp; &nbsp; &nbsp;  $network<br /># Should-Stop:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $network<br /># Default-Start:&nbsp; &nbsp; &nbsp; &nbsp; 2 3 4 5<br /># Default-Stop:&nbsp; &nbsp; &nbsp; &nbsp;  0 1 6<br /># Short-Description:&nbsp; &nbsp; OpenERP Web - the Web Client of the OpenERP<br /># Description:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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=&quot;openerp&quot;<br /><br /># Specify an alternate config file (Default: /etc/openerp-web.cfg).<br />CONFIGFILE=&quot;/etc/openerp-web.cfg&quot;<br /><br /># pidfile<br />PIDFILE=/var/run/$NAME.pid<br /><br /># Additional options that are passed to the Daemon.<br />DAEMON_OPTS=&quot;-c $CONFIGFILE&quot;<br /><br />[ -x $DAEMON ] || exit 0<br />[ -f $CONFIGFILE ] || exit 0<br /><br />checkpid() {<br />&nbsp; &nbsp; [ -f $PIDFILE ] || return 1<br />&nbsp; &nbsp; pid=`cat $PIDFILE`<br />&nbsp; &nbsp; [ -d /proc/$pid ] &amp;&amp; return 0<br />&nbsp; &nbsp; return 1<br />}<br /><br />if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then<br /><br />&nbsp; &nbsp; do_start() {<br />&nbsp; &nbsp; &nbsp; &nbsp; start-stop-daemon --start --quiet --pidfile $PIDFILE \<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --chuid $USER&nbsp; --background --make-pidfile \<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --exec $DAEMON -- $DAEMON_OPTS<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; RETVAL=$?<br />&nbsp; &nbsp; &nbsp; &nbsp; sleep 5&nbsp; &nbsp; &nbsp; &nbsp;  # wait for few seconds<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return $RETVAL<br />&nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; do_stop() {<br />&nbsp; &nbsp; &nbsp; &nbsp; start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; RETVAL=$?<br />&nbsp; &nbsp; &nbsp; &nbsp; sleep 2&nbsp; &nbsp; &nbsp; &nbsp;  # wait for few seconds<br />&nbsp; &nbsp; &nbsp; &nbsp; rm -f $PIDFILE&nbsp; # remove pidfile<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return $RETVAL<br />&nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; do_restart() {<br />&nbsp; &nbsp; &nbsp; &nbsp; start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; sleep 2&nbsp; &nbsp; &nbsp; &nbsp;  # wait for few seconds<br />&nbsp; &nbsp; &nbsp; &nbsp; rm -f $PIDFILE&nbsp; # remove pidfile<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; start-stop-daemon --start --quiet --pidfile $PIDFILE \<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --chuid $USER --background --make-pidfile \<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --exec $DAEMON -- $DAEMON_OPTS<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; RETVAL=$?<br />&nbsp; &nbsp; &nbsp; &nbsp; sleep 5&nbsp; &nbsp; &nbsp; &nbsp;  # wait for few seconds<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return $RETVAL<br />&nbsp; &nbsp; }<br /><br />else<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; do_start() {<br />&nbsp; &nbsp; &nbsp; &nbsp; $DAEMON $DAEMON_OPTS &gt; /dev/null 2&gt;&amp;1 &amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; RETVAL=$?<br />&nbsp; &nbsp; &nbsp; &nbsp; sleep 5&nbsp; &nbsp; &nbsp; &nbsp;  # wait for few seconds<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; echo $! &gt; $PIDFILE&nbsp; # create pidfile<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return $RETVAL<br />&nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; do_stop() {<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; pid=`cat $PIDFILE`<br />&nbsp; &nbsp; &nbsp; &nbsp; kill -15 $pid<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; RETVAL=$?<br />&nbsp; &nbsp; &nbsp; &nbsp; sleep 2&nbsp; &nbsp; &nbsp; &nbsp;  # wait for few seconds<br />&nbsp; &nbsp; &nbsp; &nbsp; rm -f $PIDFILE&nbsp; # remove pidfile<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return $RETVAL<br />&nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; do_restart() {<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; if [ -f $PIDFILE ]; then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do_stop<br />&nbsp; &nbsp; &nbsp; &nbsp; fi<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; do_start<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return $?<br />&nbsp; &nbsp; }<br /><br />fi<br /><br />start_daemon() {<br /><br />&nbsp; &nbsp; if [ -f $PIDFILE ]; then<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;pidfile already exists: $PIDFILE&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; exit 1<br />&nbsp; &nbsp; fi<br /><br />&nbsp; &nbsp; echo -n &quot;Starting $DESC: &quot;<br /><br />&nbsp; &nbsp; do_start<br /><br />&nbsp; &nbsp; checkpid<br /><br />&nbsp; &nbsp; if [ $? -eq 1 ]; then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; rm -f $PIDFILE<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;failed.&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; exit 1<br />&nbsp; &nbsp; fi<br /><br />&nbsp; &nbsp; echo &quot;done.&quot;<br />}<br /><br />stop_daemon() {<br /><br />&nbsp; &nbsp; checkpid<br /><br />&nbsp; &nbsp; if [ $? -eq 1 ]; then<br />&nbsp; &nbsp; &nbsp; &nbsp; exit 0<br />&nbsp; &nbsp; fi<br /><br />&nbsp; &nbsp; echo -n &quot;Stopping $DESC: &quot;<br /><br />&nbsp; &nbsp; do_stop<br /><br />&nbsp; &nbsp; if [ $? -eq 1 ]; then<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;failed.&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; exit 1<br />&nbsp; &nbsp; fi<br /><br />&nbsp; &nbsp; echo &quot;done.&quot;<br />}<br /><br />restart_daemon() {<br /><br />&nbsp; &nbsp; echo -n &quot;Reloading $DESC: &quot;<br /><br />&nbsp; &nbsp; do_restart<br /><br />&nbsp; &nbsp; checkpid<br /><br />&nbsp; &nbsp; if [ $? -eq 1 ]; then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; rm -f $PIDFILE<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;failed.&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; exit 1<br />&nbsp; &nbsp; fi<br /><br />&nbsp; &nbsp; echo &quot;done.&quot;<br />}<br /><br />status_daemon() {<br /><br />&nbsp; &nbsp; echo -n &quot;Checking $DESC: &quot;<br /><br />&nbsp; &nbsp; checkpid<br /><br />&nbsp; &nbsp; if [ $? -eq 1 ]; then<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;stopped.&quot;<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;running.&quot;<br />&nbsp; &nbsp; fi<br />}<br /><br />case &quot;$1&quot; in<br />&nbsp; &nbsp; start) start_daemon ;;<br />&nbsp; &nbsp; stop) stop_daemon ;;<br />&nbsp; &nbsp; restart|force-reload) restart_daemon ;;<br />&nbsp; &nbsp; status) status_daemon ;;<br />&nbsp; &nbsp; *)<br />&nbsp; &nbsp; &nbsp; &nbsp; N=/etc/init.d/$NAME<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Usage: $N {start|stop|restart|force-reload|status}&quot; &gt;&amp;2<br />&nbsp; &nbsp; &nbsp; &nbsp; exit 1<br />&nbsp; &nbsp; &nbsp; &nbsp; ;;<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__ == &quot;__main__&quot;:<br />&nbsp; &nbsp; try:<br />&nbsp; &nbsp; &nbsp; &nbsp; start()<br />&nbsp; &nbsp; except ConfigurationError, exc:<br />&nbsp; &nbsp; &nbsp; &nbsp; sys.stderr.write(str(exc)+&quot;\n&quot;)<br />&nbsp; &nbsp; &nbsp; &nbsp; sys.exit(1)<br />
    





  • 照着做了,但是重启后发现,openerp并没有启动起来,用chkconfig查看,openerp是on的状态,但是实际并没有启动。暂时先放弃了,装了一个X,启动了两个concole…………



  • 照着校长的做,然后执行下面命令就OK,然后重启就启动为服务了
    sudo update-rc.d openerp-web defaults 90 2 3 4 5 6



  • 谢谢lky,我试一下



  • 在UBUNTU桌面版下可以看我的O基础安装,后面也有自启动OEWEB.