This question has been flagged
3 Replies
25644 Views

Hello, First, sorry for my por english... i'm french!

Last night I installed Openerp 7 on a remote VPS server. I start the server from my iMac using "/opt/openerp/server/openerp-server" on the terminal with SSH. Everything runs OK.

But every time I close the terminal the Openerp server goes down What can I do to keep it running?

Thank guy's!

Avatar
Discard

via bash-shell per ssh you could use "nohup [yourcommand] > /dev/null 2>&1 &" then you'll be able to close the terminal without interrupting the process launched from within that ssh session. aside from that, you'll probably need some kind of init script, e.g. /etc/init.d/openerp - you can find some basic example here: http://pastie.org/6342884 - but it's for my debian machine and probably won't work with your system without modifications (e.g. my config file is located at /etc and so on). oh, and i just stumbled upon a thread down here: http://bit.ly/YAqyYi - it provides a script for ubuntu.

If you consider that your question has been answered it is a courtesy to those who answered to indicate which answer solved your problem.

Best Answer

If you're on Ubuntu, you can use an Upstart configuration file to autostart and manage your OpenERP instance.

Assuming you have a system user called "openerp", the following should work:

description "OpenERP 7.0"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec su -s /bin/sh -c 'exec "$0" "$@"' openerp -- /opt/openerp/server/openerp-server -c /opt/openerp/config-server70.cfg --logfile=/opt/openerp/openerp-7.0.log $@

Adjust the config and log paths as you wish, and then save this in as /etc/init/openerp.conf.

Then, it will not only be automatically started on boot - as restarted if it dies, due to the respawn directive -, but you can also run restart openerp, stop openerp, etc instead of having to manually find the pid and kill it.

P.S.: The whole su -s /bin/sh -c exec ... is an Upstart "trick" to make OpenERP run as the "openerp" user, otherwise it would run as root!

Avatar
Discard

Thank you for the great tip. Don't forget to enable Upstart for all users, which is done in Upstart1.8 by: 1. Uncomment "ubuntu" in file /etc/upstart-xsessions. 2. Logout of any desktop sessions. 3. Login to the default Unity session.

Also, I modified the code slightly to get it to work:

description "OpenERP 7.0"

start on runlevel [2345] stop on runlevel [!2345]

respawn

exec su -s /bin/sh -c 'exec "$0" "$@"' openerp -- /opt/openerp/v7/server/openerp-server -c /etc/openerp-server.conf --logfile=/opt/openerp/openerp-7.0.log $@

Tip to troubleshoot: sudo bash /etc/init/openerp.conf

Since Upstart 1.4, instead of the whole su -s /bin/sh ... ordeal, you can just use setuid <user you want to start openerp as> e.g. setuid openerp

Best Answer

It's possible to keep your SSH sessions alive and running even if you disconnect from them For that use screen or byobu (Byobu runs on top of screen but provides additional features).

You can shut-down your laptop at the office, turn it on at home, and reconnect to the sessions you left running, and everything will be there just as you left them!

Avatar
Discard

@Daniel Reis: I have start my opener server using screen command but when i reboot my server, openerp server stop. is there any solution related this command pls help

Best Answer

If you want a simple fix, just run the same command you were using and append the ampersand & after it, like this :

/opt/openerp/server/openerp-server &

That tells the server you want it to fork the command into an independently running (background) process. To bring it back to the foreground, just type fg.

fg

You don't indicate which operating system you are using, but this guide got me going immediately on an Ubuntu Precise Pangolin VPS . . .

http://www.theopensourcerer.com/2012/12/how-to-install-openerp-7-0-on-ubuntu-12-04-lts/

. . . &/or (if that is still broken) this too . . .

https://accounts.openerp.com/forum/Help-1/question/2562/

With one of those you ought to be able to reboot your VPS, and have it come back up with PostgreSQL and OpenERP ready to user without further intervention.

Avatar
Discard

plse anybody know how to autostart the openerp server on the Debian operating system.

@Alemu :I have facing same prolem