File rc.openerp-web of Package openerp-web
#!/bin/bash
# Copyright 2008 Gerry Reno. License: GPL v3.0 or later at your discretion.
# Copyright 2009 Leo Eraly. License: GPL v3.0 (Suse )
# /etc/init.d/openerp-server
#
# This shell script takes care of starting and stopping openerp server
#
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $syslog $remote_fs
# Should-Start: $time ypbind smtp
# Required-Stop: $syslog $remote_fs
# Should-Stop: ypbind smtp
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: OpenERP-server
# Description: Starting openERP-server
### END INIT INFO
svr="${2:+-$2}"
LOGFILE=/var/log/openerp/openerp-web.log
PIDFILE=/var/run/openerp-web.pid
CONFIGFILE=/etc/openerp-web.cfg
OPENERP_BIN=/usr/bin/openerp-web
OPENERP_UID=`id -u openerp > /dev/null 2>&1`
if test -z $OPENERP_UID
then
echo "No openerp user found"
exit 1
fi
test -x $OPENERP_BIN || { echo "$OPENERP_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
OPENERP_CONFIG=/etc/openerp-server$svr.conf
test -r $OPENERP_CONFIG || { echo "$OPENERP_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
OPTS="-c $CONFIGFILE"
prog="openerp-web"
. /etc/rc.status
# Reset status of this service
rc_reset
start() {
echo -n $"Starting $prog: "
/sbin/startproc -u $OPENERP_UID -p $PIDFILE "$OPENERP_BIN $OPTS"
rc_status -v
}
case "$1" in
start)
echo -n $"Starting $prog: "
/sbin/startproc -u $OPENERP_UID "$OPENERP_BIN $OPTS"
rc_status -v
;;
stop)
echo -n $"Stopping $prog: "
/sbin/killproc -p $PIDFILE -TERM $OPENERP_BIN
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for service openerp-web "
/sbin/checkproc -p $PIDFILE $OPENERP_BIN
rc_status -v
;;
*)
echo $"Usage: $0 {start|stop|status|restart|}"
exit 1
esac
exit $?