# start/stop/restart the jetty service for solr JAVA=$(which java) ROOT=$(dirname $0) TIMEOUT=30 JPORT=38983 STOP=38984 STOPKEY=stopkey # figure out which netcat we're using (fedora | darwin | ubuntu) if [ -f /etc/lsb-release ]; then os=$(lsb_release -s -d) elif [ -f /etc/debian_version ]; then os="Debian $(cat /etc/debian_version)" elif [ -f /etc/redhat-release ]; then os=`cat /etc/redhat-release` else os="$(uname -s) $(uname -r)" fi baseos=$(echo $os | cut -d ' ' -f 1) case "$baseos" in Darwin) NETCAT=$(which nc) NETCAT_OPTS="-z localhost $JPORT" ;; Fedora) # fedora without netcat NETCAT=$(which ncat) if [ "$NETCAT" == "" ]; then NETCAT_SPECIAL=1 NETCAT="/dev/tcp/localhost/$JPORT" NETCAT_OPTS="" else NETCAT_OPTS="--send-only --recv-only localhost $JPORT" fi ;; *) # assume ubuntu NETCAT=$(which netcat) NETCAT_OPTS="-z localhost $JPORT" ;; esac if [ "$NETCAT" == "" ]; then echo "netcat, ncat, or nc need to be installed" return 1 fi tryOnce() { if [ "$NETCAT_SPECIAL" == "1" ]; then 2> /dev/null > ${NETCAT} 2> /dev/null 1> /dev/null else ${NETCAT} ${NETCAT_OPTS} 2> /dev/null 1> /dev/null fi return $? } portReachable() { # wait for 1 minute, then give up for i in $(seq 1 60); do tryOnce if [ $? -eq "0" ]; then return 0 else echo -n "." sleep 1 fi done return 1 } case "$1" in start) echo -n "Starting solr: " $JAVA -Xmx1G -Dsolr.solr.home=$ROOT/solr -Djetty.home=$ROOT -Djetty.port=$JPORT -DSTOP.PORT=$STOP -DSTOP.KEY=$STOPKEY -jar $ROOT/start.jar 1> /dev/null & sleep 1 if portReachable then RETVAL=0 echo "OK" else RETVAL=1 echo "FAILED" fi ;; stop) if tryOnce ; then echo -n "Stopping solr: " $JAVA -Dsolr.solr.home=$ROOT/solr -Djetty.home=$ROOT -DSTOP.PORT=$STOP -DSTOP.KEY=$STOPKEY -jar $ROOT/start.jar --stop sleep 1 if tryOnce ; then echo FAILED else echo OK fi RETVAL=$? else echo "not running" fi ;; status) if tryOnce ; then echo "running" else echo "stopped" fi RETVAL=$? ;; restart) $0 stop $0 start RETVAL=$? ;; *) echo "Usage: solr-control.sh {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/build/scripts/solr-control.sh | |||||
#2 | 9007 | Doug Scheirer |
update workshop p4-search with the latest released code: * code updates - bug fixes * adding jetty + solr tarballs * script updates * updated p4java jar to latest release |
||
#1 | 8975 | Matt Attaway | Populate official version of p4-search from the original Doug Scheirer source |