#!/bin/sh # # /etc/init.d/perforce # Subsystem file for "Perforce" server # # chkconfig: 2345 95 05 # description: Perforce server daemon # # processname: Perforce # pidfile: /var/run/perforce.pid # source function library #. /etc/rc.d/init.d/functions RETVAL=0 prog="Perforce" export P4PORT=0.0.0.0:1666 export P4USER=pi export P4ROOT=/home/pi/p4root start(){ echo -n "Starting $prog:\n" p4d -r $P4ROOT -p $P4PORT -u pi -d RETVAL=$? [ "$RETVAL" = 0 ] && touch /var/lock/subsys/$prog echo } stop() { echo -n "Stopping $prog:\n" p4 -u pi admin stop RETVAL=$? [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/$prog echo } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if [ -f /var/lock/subsys/$prog ] ; then stop # avoid race sleep 3 start fi ;; status) status $prog RETVAL=$? ;; *) (10) echo $"Usage: $0 {start|stop|restart|condrestart|status}" RETVAL=1 esac exit $RETVAL