Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

Automatically start OpenERP on server boot

By
prouvez
on 2/26/13, 1:51 PM 14,069 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!

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.

Marco
on 2/26/13, 2:07 PM

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

Martin
on 2/27/13, 12:17 PM
6
app
On 2/27/13, 11:53 AM

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!

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 $@

Greg Boban
on 6/15/13, 7:57 PM

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

Daniel Reis
on 9/6/13, 12:59 PM

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

Leonardo Donelli
on 1/7/14, 6:35 AM
0

Martin

--Martin--
1978
| 5 6 8
Cornwall, Canada
--Martin--

Analysing, designing, coding and mentoring since 1975. Kilobytes to terabytes. Punch cards to punchy sites. My OpenERP video series: http://www.youtube.com/playlist?list=PLq7op4J183lX44ZlXPiHxUpRvmmRDtxye My Google Speadsheets --> OpenERP Data Pump project: http://martinhbramwell.github.io/GData_OpenERP_Data_Pump My email (with spaces removed) : mhb . warehouseman @ gmail . com

Martin
On 2/26/13, 6:10 PM

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.

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

Alemu
on 6/20/13, 6:10 AM

@Alemu :I have facing same prolem

Jagdish Panchal
on 1/6/14, 2:51 AM
0

Daniel Reis

--Daniel Reis--
3436
| 6 7 9
Lisbon, Portugal
--Daniel Reis--

Author of the "Odoo Development Essentials" book.

Applications Manager at Securitas Portugal

Github: https://github.com/dreispt

Twitter; @reis_pt


Daniel Reis
On 9/6/13, 1:12 PM

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!

@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

Jagdish Panchal
on 1/6/14, 2:06 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 2/26/13, 1:51 PM
Seen: 14069 times
Last updated: 11/24/15, 11:06 AM