Created
April 26, 2013 14:22
-
-
Save mrsarm/5467702 to your computer and use it in GitHub Desktop.
OpenERP Unix Startup Script. It's a fork of the original OpenERP script but with the "status" option to check if the daemon is running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# /etc/init.d/openerp | |
# | |
# Startup script for OpenERP server. | |
# | |
# Author: OpenERP SA | |
# Modified by Mariano Ruiz <mrsarm@gmail.com> (2013) | |
### BEGIN INIT INFO | |
# Provides: openerp-server | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# 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 | |
DAEMON_FOLDER=/usr/bin | |
DAEMON=${DAEMON_FOLDER}/openerp-server | |
NAME=openerp-server | |
DESC=openerp-server | |
USER=openerp | |
CONFIG_FOLDER=/etc/openerp | |
LOGFILE_FOLDER=/var/log | |
PID_FOLDER=/var/run | |
CONFIG=${CONFIG_FOLDER}/openerp-server.conf | |
LOGFILE=${LOGFILE_FOLDER}/openerp-server.log | |
test -x ${DAEMON} || exit 0 | |
set -e | |
. /lib/lsb/init-functions | |
case "${1}" in | |
start) | |
echo -n "Starting ${DESC}: " | |
start-stop-daemon --start --quiet --pidfile ${PID_FOLDER}/${NAME}.pid \ | |
--chuid ${USER} --background --make-pidfile \ | |
--exec ${DAEMON} -- --config=${CONFIG} \ | |
--logfile=${LOGFILE} | |
echo "${NAME}." | |
;; | |
stop) | |
echo -n "Stopping ${DESC}: " | |
start-stop-daemon --stop --quiet --pidfile ${PID_FOLDER}/${NAME}.pid \ | |
--oknodo | |
echo "${NAME}." | |
;; | |
restart|force-reload) | |
echo -n "Restarting ${DESC}: " | |
start-stop-daemon --stop --quiet --pidfile ${PID_FOLDER}/${NAME}.pid \ | |
--oknodo | |
sleep 1 | |
start-stop-daemon --start --quiet --pidfile ${PID_FOLDER}/${NAME}.pid \ | |
--chuid ${USER} --background --make-pidfile \ | |
--exec ${DAEMON} -- --config=${CONFIG} \ | |
--logfile=${LOGFILE} | |
echo "${NAME}." | |
;; | |
status) | |
status_of_proc -p ${PID_FOLDER}/${NAME}.pid ${DAEMON} ${DESC} && exit 0 || exit $? | |
;; | |
*) | |
N=/etc/init.d/${NAME} | |
echo "Usage: ${NAME} {start|stop|restart|force-reload|status}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment