#!/bin/sh
#
# p4d This shell script take care of starting and stopping
# p4d (Perforce Daemon).
#
# chkconfig: 345 80 20
# description: Start the perforce daemon and the review daemon
# Source function library
. /etc/init.d/functions
# Source networking configuration
. /etc/sysconfig/network
# Check that networking is up
[ ${NETWORKING} = "no" ] && exit 0
# Fixup the path to perforce
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rcs/perforce/bin
# set some important perforce variables
P4ROOT=/rcs/perforce/root
P4LOG=/var/log/p4d/p4d.log
P4REVIEWLOG=/var/log/p4d/p4review.log
#P4USER=p4user
#P4PORT=perforce:1666
RETVAL=0
start() {
# export the important variables
export P4ROOT P4USER P4PORT
# Start daemons
echo -n "Starting p4d: "
daemon --user $P4USER /rcs/perforce/bin/p4d -d -L $P4LOG -r $P4ROOT
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
echo -n "Starting p4review: "
su -s /bin/bash - $P4USER -c "/rcs/perforce/bin/p4review > $P4REVIEWLOG 2>&1 < /dev/zero &"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/p4d
fi
return $RETVAL
}
stop() {
# Stop daemons
echo -n "Shutting down p4review: "
killproc p4review
RETVAL=$?
echo
echo -n "Shutting down p4d: "
killproc p4d
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/p4d
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status p4d
RETVAL=$?
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/p4d ]; then
stop
start
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
# |
Change |
User |
Description |
Committed |
|
#1
|
2345 |
Charles Hardin |
a handy little p4d init script for redhat boxes |
|
|