#!/bin/sh # # Start/stop the p4d service ROOT=$(dirname $0) P4PORT=6666 PROCPATH="." set_p4dPath() { OSNAME=$(uname) if [ "Darwin" = "$OSNAME" ] ; then PROCPATH=darwin90x86_64 elif [ "Linux" = "$OSNAME" ] ; then if [ -z $(uname -m | grep 64) ] ; then PROCPATH=$ROOT/linux26x86 else PROCPATH=$ROOT/linux26x86_64 fi fi PATH=$PROCPATH:$PATH } # Unicode support # if the server is a unicode server, uncomment this line #export P4CHARSET=utf8 SUPER=indexUser SUPERPASS=indexPassword P4ROOT=$ROOT/tmp/searchtest P4LOG=p4d.log P4DCMD="p4d -r $P4ROOT -L $P4LOG -J off -p $P4PORT -d" running_check() { status_p4d=$(p4 -p$P4PORT info 2> /dev/null) if [ -z "$status_p4d" ] ; then return 1 else return 0 fi } running() { running_check if [ $? -eq "0" ]; then echo "OK" return 0 else echo "FAILED" return 1 fi } stop_running_loop() { # wait for up to 1 minute for i in $(seq 1 60) do running_check if [ $? -eq "1" ]; then echo "OK" return 0 fi sleep 1 done echo "FAILED" return 1 } RETVAL=0 set_p4dPath # See how we were called. case "$1" in start) $P4DCMD sleep 1 running RETVAL=$? ;; stop) running_check RETVAL=$? if [ $RETVAL != "0" ]; then echo "not running" exit 1 fi echo -n "Stopping Perforce server: " echo $SUPERPASS | p4 -p$P4PORT -u $SUPER login; p4 -p$P4PORT -u $SUPER admin stop sleep 1 stop_running_loop RETVAL=$? ;; status) running_check RETVAL=$? if [ $RETVAL -eq "0" ]; then echo "running" else echo "stopped" fi ;; restart) $0 stop $0 start RETVAL=$? ;; *) echo "Usage: p4d {start|stop|status|restart}" exit 1 esac exit $RETVAL
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 18866 | Sven Erik Knop | Updated with latest version | ||
#1 | 9795 | Sven Erik Knop |
Populate //guest/sven_erik_knop/p4search/... from //guest/perforce_software/p4search/.... |
||
//guest/perforce_software/p4search/search/test/libs/p4d/p4d-control.sh | |||||
#1 | 8975 | Matt Attaway | Populate official version of p4-search from the original Doug Scheirer source | ||
//guest/doug_scheirer/p4-search/search/test/libs/p4d/p4d-control.sh | |||||
#1 | 8476 | Doug Scheirer | p4-search copy from //depot/main/p4-search |