#!/bin/bash
#
# This allows this script to be crudely reused for multiple instances
# on one host by making a renamed copy of the script, and changing the
# value of "IM" ("I am"):
#
IM=`basename $0`;
# description: The Perforce Server
# processname: $IM
# config: /etc/sysconfig/$IM
# chkconfig: 345 99 10
#
# rmg 1/13/2003 for Data Domain, Inc.
# Source function library.
#
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
# Get config.
#
if [ -f /etc/sysconfig/$IM ]; then
. /etc/sysconfig/$IM
else
exit 0
fi
start() {
status $IM > /dev/null 2>&1
if [ $? -ne 0 -a "$P4DCMD" != "" ]; then
echo -n $"Starting Perforce Server ($IM): "
if [ "$P4USER" != "" ]; then P4USER="--user $P4USER "; fi
daemon $P4USER$P4DCMD
RETVAL=$?
echo
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/$IM
else
RETVAL=0
fi
}
stop() {
status $IM > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -n $"Stopping Perforce Server ($IM): "
killproc $IM
RETVAL=$?
echo
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/$IM
fi
}
restart() {
stop
start
}
# See how we are called.
case "$1" in
start) start ;;
stop) stop ;;
restart) restart ;;
condrestart) [ -f /var/lock/subsys/$IM ] && restart || : ;;
status) status $IM ;;
*) echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL