#!/bin/bash

CMDNAME=`basename "$0"`

SOLR_PATH=/opt/local/share/java/solr-8.11.4

# If not already defined, export these environment variables for bin/solr
# see bin/solr start -help
if [ -z "$SOLR_HOME" ]; then export SOLR_HOME=/opt/local/var/solr; fi
if [ -z "$SOLR_DATA_HOME" ]; then export SOLR_DATA_HOME=/opt/local/var/db/solr; fi
if [ -z "$SOLR_LOGS_DIR" ]; then export SOLR_LOGS_DIR=/opt/local/var/solr/logs; fi
if [ -z "$SOLR_PID_DIR" ]; then export SOLR_PID_DIR=/opt/local/var/run/solr; fi
if [ -z "$SOLR_PORT" ]; then export SOLR_PORT=8983; fi
if [ -z "$SOLR_HEAP" ]; then export SOLR_HEAP=1g; fi
# if [ -z "$SOLR_JAVA_MEM" ]; then export SOLR_JAVA_MEM=@solr_java_mem@; fi
if [ -z "$SOLR_LOG_PRESTART_ROTATION" ]; then export SOLR_LOG_PRESTART_ROTATION=true; fi
if [ -z "$SOLR_ULIMIT_CHECKS" ]; then export SOLR_ULIMIT_CHECKS=false; fi
 
# this shell function is not used, but instructive here
usage() {
    echo "Usage: See ${SOLR_PATH}/bin/solr" 1>&2
    exit 1
}

${SOLR_PATH}/bin/solr $*
