Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I using using jetty to run Solr using the following cmd line: java -jar start.jar &

how can I stop this instance of solr gracefully?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Find the process id with ps and send it a signal to stop using kill - I believe the HUP or INT signals will allow the java process to gracefully exit; test to confirm.

Better yet, you should really be using a proper service to run Solr - Tomcat can do this, or Jetty can be made to run as a service.

share|improve this answer
I currently use ps and kill with HUP. I was hoping for a more elegant way, where I don't have to lookup the process ID and then send the kill HUP. –  Saqib Ali Feb 1 '13 at 12:32
@SaqibAli The elegant way to do it would be to set it up as a service via an init script - either by using a servlet engine like Tomcat that comes set up for that, or by setting one up for your Jetty process. –  Shane Madden Feb 1 '13 at 20:22

Start it (defining stop.port and stop.key variables):

java -DSTOP.PORT=8080 -DSTOP.KEY=stop_jetty -jar start.jar

then you can stop it:

java -DSTOP.PORT=8080 -DSTOP.KEY=stop_jetty -jar start.jar --stop


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.