Solr Chkconfig and start/stop scripts
Posted July 9, 2007 at 10:07pm in Computers, Programming
These are very simple, there is no check to see if it is running and no error handling. This is my first chkconfig script and I am not bash brilliant.
*Note: The syntax highligher is replacing the double dashes (–) in the solr.stop script so please click the “Show Plain Code” when copying. I will find the bug in the script to avoid having to do that.
In /etc/init.d/solr
Bash
-
#!/bin/bash
-
#
-
# chkconfig: - 80 45
-
# description: Starts and stops Solr
-
-
start() {
-
echo -n "Starting Solr… "
-
nohup /opt/directory/solr.start
-
echo "OK"
-
return 0
-
}
-
-
stop() {
-
echo -n "Stopping Solr… "
-
/opt/directory/solr.stop
-
echo "OK"
-
return 0
-
}
-
-
case "$1" in
-
start)
-
start
-
;;
-
stop)
-
stop
-
;;
-
restart)
-
stop
-
start
-
;;
-
*)
-
echo $"Usage: $0 {start|stop|restart}"
-
exit 1
-
esac
-
-
exit $?
This is the /opt/directory/solr.start file
Bash
-
#!/bin/bash
-
cd /opt/directory/
-
/usr/java/jdk1.6.0_01/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=ftasolrstop -jar start.jar &
This is the /opt/directory/solr.stop file
Bash
-
#!/bin/bash
-
cd /opt/directory/
-
/usr/java/jdk1.6.0_01/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=ftasolrstop -jar start.jar –stop





