Er, what flavor? RHEL / CentOS
#!/bin/sh # Starts, stops, and restarts Apache Solr. # # chkconfig: 35 92 08 # description: Starts and stops Apache Solr SOLR_DIR="/var/solr" JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mustard -jar start.jar" LOG_FILE="/var/log/solr.log" JAVA="/usr/bin/java" case $1 in start) echo "Starting Solr" cd $SOLR_DIR $JAVA $JAVA_OPTIONS 2> $LOG_FILE & ;; stop) echo "Stopping Solr" cd $SOLR_DIR $JAVA $JAVA_OPTIONS --stop ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {start|stop|restart}" >&2 exit 1 ;; esac ________________________________ Debian http://xdeb.org/node/1213 ______________________ Ubuntu STEPS Type in the following command in TERMINAL to install nano text editor. sudo apt-get install nano Type in the following command in TERMINAL to add a new script. sudo nano /etc/init.d/solr TERMINAL will display a new page title "GNU nano 2.0.x". Paste the below script in this TERMINAL window. #!/bin/sh -e # Starts, stops, and restarts solr SOLR_DIR="/apache-solr-1.4.0/example" JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar" LOG_FILE="/var/log/solr.log" JAVA="/usr/bin/java" case $1 in start) echo "Starting Solr" cd $SOLR_DIR $JAVA $JAVA_OPTIONS 2> $LOG_FILE & ;; stop) echo "Stopping Solr" cd $SOLR_DIR $JAVA $JAVA_OPTIONS --stop ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {start|stop|restart}" >&2 exit 1 ;; esac Note: In above script you might have to replace /apache-solr-1.4.0/example with appropriate directory name. Press CTRL-X keys. Type in Y When ask File Name to Write press ENTER key. You're now back to TERMINAL command line. Type in the following command in TERMINAL to create all the links to the script. sudo update-rc.d solr defaults Type in the following command in TERMINAL to make the script executable. sudo chmod a+rx /etc/init.d/solr To test. Reboot your Ubuntu Server. Wait until Ubuntu Server reboot is completed. Wait 2 minutes for Apache Solr to startup. Using your internet browser go to your website and try a Solr search. -----Original Message----- From: Nikola Garafolic [mailto:nikola.garafo...@srce.hr] Sent: Monday, November 08, 2010 11:42 PM To: solr-user@lucene.apache.org Subject: solr init.d script Hi, Does anyone have some kind of init.d script for solr, that can start, stop and check solr status? -- Nikola Garafolic SRCE, Sveucilisni racunski centar tel: +385 1 6165 804 email: nikola.garafo...@srce.hr