Closed DocCyblade closed 9 years ago
Possible fix would be to change the init script to something like below. I am thinking we could pull the log file out of here and keep it in the openerp-server.conf file, see #41
#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $remote_fs $syslog postgresql apache2
# Required-Stop: $remote_fs $syslog postgresql apache2
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Resource Management software
# Description: Open ERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/openerp/odoo/openerp-server
NAME=openerp-server
DESC=openerp-server
CONFIG=/etc/odoo/openerp-server.conf
LOGFILE=/var/log/odoo/openerp-server.log
DAEMON_LOGFILE=/var/log/odoo/openerp-server-startup.log
USER=openerp
test -x ${DAEMON} || exit 0
set -e
case "${1}" in
start)
echo -n "Starting ${DESC}: "
echo "`date` - Starting ${DESC}: " >> ${DAEMON_LOGFILE}
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --no-close --make-pidfile \
--exec ${DAEMON} -- --config=${CONFIG} --logfile=${LOGFILE} >> ${DAEMON_LOGFILE} 2>&1
echo "${NAME}."
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
--oknodo
echo "`date` - Stopping ${DESC}: " >> ${DAEMON_LOGFILE}
echo "${NAME}."
;;
restart|force-reload)
echo -n "Restarting ${DESC}: "
echo "`date` - Restarting ${DESC}: " >> ${DAEMON_LOGFILE}
echo "`date` - Stopping ${DESC}: " >> ${DAEMON_LOGFILE}
start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
--oknodo
sleep 5
echo "`date` - Starting ${DESC}: " >> ${DAEMON_LOGFILE}
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --no-close --make-pidfile \
--exec ${DAEMON} -- --config=${CONFIG} --logfile=${LOGFILE} >> ${DAEMON_LOGFILE} 2>&1
echo "${NAME}."
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
``
As for #41
we could do this
#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $remote_fs $syslog postgresql apache2
# Required-Stop: $remote_fs $syslog postgresql apache2
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Resource Management software
# Description: Open ERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/openerp/odoo/openerp-server
NAME=openerp-server
DESC=openerp-server
CONFIG=/etc/odoo/openerp-server.conf
DAEMON_LOGFILE=/var/log/odoo/openerp-server-startup.log
USER=openerp
test -x ${DAEMON} || exit 0
set -e
case "${1}" in
start)
echo -n "Starting ${DESC}: "
echo "`date` - Starting ${DESC}: " >> ${DAEMON_LOGFILE}
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --no-close --make-pidfile \
--exec ${DAEMON} -- --config=${CONFIG} >> ${DAEMON_LOGFILE} 2>&1
echo "${NAME}."
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
--oknodo
echo "`date` - Stopping ${DESC}: " >> ${DAEMON_LOGFILE}
echo "${NAME}."
;;
restart|force-reload)
echo -n "Restarting ${DESC}: "
echo "`date` - Restarting ${DESC}: " >> ${DAEMON_LOGFILE}
echo "`date` - Stopping ${DESC}: " >> ${DAEMON_LOGFILE}
start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
--oknodo
sleep 5
echo "`date` - Starting ${DESC}: " >> ${DAEMON_LOGFILE}
start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --no-close --make-pidfile \
--exec ${DAEMON} -- --config=${CONFIG} >> ${DAEMON_LOGFILE} 2>&1
echo "${NAME}."
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
``
@JedMeister would like your input on this issue
Nice one! :+1: I think that's a great idea...
Although now that it has 2 log files (assuming I'm right on my understanding of what you are doing; one for the Odoo daemon, one actually for the Odoo app) perhaps for cleanliness it might make sense to make a /var/log/odoo and put both logfiles in there.?
It's only cosmetic though really and isn't neccessary. It may appeal to your OCD though @DocCyblade :wink:
@JedMeister - Yes two log files, one really only to show the service stop/start and most importantly if the script crashes (and it does when things go really wrong) before logging starts so we know WHY Odoo did not start. I have tested this and it works like a :candy: treat. Very helpful. Wish I thought of that weeks ago!
As for the directory, already did that :smiley_cat: one step ahead of ya, and yes my OCD comes out some times. Look at the config file for logging...
Great work! :+1: Sorry I missed that...
@DocCyblade Fill me in on the "two" log files. I must have been looking at the brief one yesterday in /var/log/openerp-server.log
Where does the other one land? Would be awesome if we could tie it into Webmin log views but probably asking a lot right now.
Thanks for working so hard on this.
@l-arnold - all Odoo logs will be at /var/log/odoo/
openerp-server.log
- This is from Odoo service
openerp-server-startup.log
- This logs start/stop of service and captures crashes (where Odoo does not start) Before we did not know why Odoo did not start. Now we can see by looking there.
Not sure how we can get this to webmin, I'll look into it :smile:
There is no log file if openerp-server crashes or has a fatal exit.