mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
52 lines
1.1 KiB
Bash
52 lines
1.1 KiB
Bash
#!/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
|