This is my simple crontab script. Please feel free to use or modify it.
Assumptions:
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.
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.
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.
Host said it was nothing. I upgraded the RAM on my server so I will see if this helps solve the issue.