#!/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 # For SELinux we need to use 'runuser' not 'su' if [ -x /sbin/runuser ]; then SU=runuser else SU=su fi # set some important perforce variables P4D=/usr/sbin/p4d P4REVIEW=/usr/sbin/p4review P4LOG=/var/log/p4d/p4d.log P4REVIEWLOG=/var/log/p4d/p4review.log P4ROOT=/rcs/perforce/root P4USER=perforce RETVAL=0 start() { # export the important variables export P4ROOT P4USER # Start daemons echo -n "Starting p4d: " daemon --user $P4USER $P4D -d -v server=3 -L $P4LOG -r $P4ROOT RETVAL=$? echo if [ $RETVAL -eq 0 ]; then echo -n "Starting p4review: " $SU -s /bin/bash - $P4USER -c "$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 } checkpoint() { # create a perforce checkpoint echo -n "Checkpoint p4d: " $SU -s /bin/bash - $P4USER -c "$P4D -r $P4ROOT -jc -z" >> $P4LOG 2>&1 < /dev/null RETVAL=$? echo "Done" return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; checkpoint) checkpoint ;; 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|checkpoint|restart|condrestart|status}" exit 1 esac exit $RETVAL
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 5434 | Charles Hardin |
dump in an rpm tree and the src rpms that were produced... this was done for internal deployment, but someone else might find it useful for packaging |