This question has been flagged
10 Replies
14694 Views

Every other day we can't connect to OpenERP. Chrome says "Oops. Can't find the webpage." To fix it, I have to run `service openerp restart` to get it back. 

 

This is tiresome getting calls about it being down every other day. Is there a common cause for this and is there a solution? It seems nothing is written to any logs about this.

Avatar
Discard

wow, from my limited experience that could be a number of issues. First, do you have a script set to auto start when the server your openerp install lives on is rebooted? If not, maintenance could be rebooting your server and killing your openerp instance. Check to see if you have maxxed out your memory resources on your server. Probably not, but worth checking. Are you running on a VPS? If so, find out if their IT is killing idle processes during peak usage hours to load manage. I'd probably check that first. If they are, switch providers asap. Check your server logs to see if you have a security issue. Change passwords and ssh keys to illiminate that minute possibility. If you still can't find a logical reason for the server stopping, one way to patch it would be a cron job that runs every so often restarting the server. Sorry that I can't help more but your problem is very vague and lacking details so this is all I can come up with.

Author

Thanks, John. I will check these things. I am running on a VPS so I will check witht he host to see if they're causing an issue.

Author

Host said it was nothing. I upgraded the RAM on my server so I will see if this helps solve the issue.

Best Answer

This is my simple crontab script. Please feel free to use or modify it.

Assumptions: 

  • home folder is /home/minamart

  • odoo script located in /home/minamart/odoo/odoo.py


Create a file called cek-minamart.sh, as below: 

#!/bin/bash
SERVICE=/home/minamart/odoo/odoo.py
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
#echo "1"
echo "$SERVICE is running well at `date`" >> /home/minamart/restart.log
else
#echo "2"
echo "$SERVICE is not running. Restarting... at `date`" >> /home/minamart/restart.log
screen -S ODOO_MINAMART-`date "+%F"`-`date "+%T"` -d -m $SERVICE
fi


Make it run every 3 minutes, or any specified time you like:

$ crontab -e

add new line

*/3 * * * * /home/minamart/cek-minamart.sh


This approach will run cek-minamart.sh script every 3 minutes and save the output result to restart.log. After some time, the restart.log filled with lines like this:

$ date
Wed Mar 23 07:48:06 WIB 2016
$ cat restart.log
/home/minamart/odoo/odoo.py is not running. Restarting... at Wed Mar 23 07:42:01 WIB 2016
/home/minamart/odoo/odoo.py is running well at Wed Mar 23 07:45:01 WIB 2016
/home/minamart/odoo/odoo.py is running well at Wed Mar 23 07:48:01 WIB 2016

/home/minamart/odoo/odoo.py is running well at Wed Mar 23 07:51:01 WIB 2016 /home/minamart/odoo/odoo.py is running well at Wed Mar 23 07:54:01 WIB 2016 /home/minamart/odoo/odoo.py is running well at Wed Mar 23 07:57:01 WIB 2016 /home/minamart/odoo/odoo.py is running well at Wed Mar 23 08:00:01 WIB 2016 /home/minamart/odoo/odoo.py is running well at Wed Mar 23 08:03:01 WIB 2016 /home/minamart/odoo/odoo.py is running well at Wed Mar 23 08:06:01 WIB 2016

It means, initially the odoo process is not running, and the script fire it up. Hope, it answered your problem.


Avatar
Discard
Best Answer

Your host is out of ram memory please add more ram or check your logs to know the root of the problem 

sudo grep -i -r 'out of memory' /var/log/
Avatar
Discard
Best Answer

Agreed with John Baldwin, there can be number of issues. Most likely issue seems with memory. How much memory system has? Check are you on *nix platform, check kernal logs, you will find there if it is memory issue.

Avatar
Discard
Best Answer

It depends on which service you are using and the plan that you have. I've been experiencing issues with 1GB of memory. But I've that problem on Webfaction since they had stopped my services when I surpassed the memory limit.

Avatar
Discard
Best Answer

Look into the upstart command - it will monitor any process and restart it if it crashes or is killed.

http://upstart.ubuntu.com/

Avatar
Discard
Author

I have Ubuntu so this looks like a promising solution. I have never heard of Upstart. Looking at the link now. Thanks.

Best Answer

It looks like you use Upstart (Maybe you use Systemd, and `service` command is only an alias), if so, check the following question:

https://askubuntu.com/questions/251577/how-to-supervise-and-automatically-restart-a-process

If you use systemd, you could change the service unit file and add the statement under [service] section:

Restart=Always
Avatar
Discard