diff options
Diffstat (limited to 'business/openerp-server/rc.openerp-server')
-rw-r--r-- | business/openerp-server/rc.openerp-server | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/business/openerp-server/rc.openerp-server b/business/openerp-server/rc.openerp-server new file mode 100644 index 0000000000000..37fa2d5bee863 --- /dev/null +++ b/business/openerp-server/rc.openerp-server @@ -0,0 +1,52 @@ +#!/bin/sh +# Start/stop/restart openerp-server. +# $Id: rc.openerp-server,v 1.1 2009/03/31 +# Author: Heinz Wiesinger <pprkut@liwjatan.at> +# --------------------------------------------------------------------------- + +PIDFILE=/var/spool/openerp/openerp-server.pid +LOCKFILE=/var/lock/subsys/openerp-server +LOGFILE=/var/log/openerp/openerp-server.log + +# Start openerp: +openerp_start() { + if [ -x /usr/bin/openerp-server ]; then + echo "Starting openerp server: /usr/bin/openerp-server " + if [ -e "$LOCKFILE" ]; then + echo "openerp server already running!" + echo "Please remove $LOCKFILE" + else + /usr/bin/openerp-server --pidfile=$PIDFILE --logfile=$LOGFILE \ + -c /etc/openerp/openerp-server.conf & + touch $LOCKFILE + fi + fi +} + +# Stop openerp: +openerp_stop() { + echo "Stopping openerp-server" + kill -TERM $(cat $PIDFILE) > /dev/null 2>&1 + rm -f $LOCKFILE +} + +# Restart openerp: +openerp_restart() { + openerp_stop + sleep 1 + openerp_start +} + +case "$1" in +'start') + openerp_start + ;; +'stop') + openerp_stop + ;; +'restart') + openerp_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac |