Solr startup script problem

Posted by Camran on Server Fault See other posts from Server Fault or by Camran
Published on 2010-05-29T16:44:57Z Indexed on 2010/05/29 16:54 UTC
Read the original article Hit count: 298

Filed under:
|
|
|
|

I have installed solr and it works finally...

I have now problems setting it up to start automatically with a start command.

I have followed a tutorial and created a file called solr in the /etc/init.d/solr dir...

Here is that file:

#!/bin/sh -e
# SOLR auto-start
#
# description: auto-starts solr engine
# processname: solr-production
# pidfile: /var/run/solr-production.pid

NAME="solr"
PIDFILE="/var/run/solr-production.pid"
LOG_FILE="/var/log/solr-production.log"
SOLR_DIR="/etc/jetty"
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
JAVA="/usr/bin/java"

start() {
  echo -n "Starting $NAME... "
  if [ -f $PIDFILE ]; then
    echo "is already running!"
  else
    cd $SOLR_DIR
    $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
    sleep 2
    echo `ps -ef | grep -v grep | grep java | awk '{print $2}'` > $PIDFILE
    echo "(Done)"
  fi
  return 0
}

stop() {
  echo -n "Stopping $NAME... "
  if [ -f $PIDFILE ]; then
    cd $SOLR_DIR
    $JAVA $JAVA_OPTIONS --stop
    sleep 2
    rm $PIDFILE
    echo "(Done)"
  else
    echo "can not stop, it is not running!"
  fi
  return 0
}

case "$1" in
  start)
    start
  ;;
  stop)
    stop
  ;;
  restart)
    stop
    sleep 5
    start
  ;;

*)
echo "Usage: $0 (start | stop | restart)"
exit 1
;;
esac

Whenever I do solr -start I get this error: "Error occurred during initialization of VM Could not reserve enough space for object heap"

I think this is because of the file above...

Also here is where I have solr installed:

var/www/solr

and here is the start.jar file located:

var/www/start.jar

Help me out if you know whats causing this.

Thanks

BTW: OS is ubuntu 9.10

© Server Fault or respective owner

Related posts about linux

Related posts about apache