slackbuilds_ponce/business/openerp-server/rc.openerp-server

53 lines
1.1 KiB
Text
Raw Normal View History

#!/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