---
title: "Upstart script for Apache Solr"
date: 2013-07-12
updated: 2026-09-26
canonical: https://michaelshadle.com/2013/07/11/upstart-script-for-apache-solr
---

# Upstart script for Apache Solr

(Apologies for not sharing my technical thoughts for six months now!)

I was trying to figure out the best way to launch Apache Solr on Ubuntu - and was having issues finding a nice clean way to do it. I decided after some misc init scripts, that I should look at Upstart. Thankfully someone (mentioned below) already had a working script available to start from.

Assumes:
- Solr will be running as user "solr" group "solr"
- Solr's root where `start.jar` is located is `/home/solr`
- This works well using Solr 4.3.1, Ubuntu 12.04.2 LTS (precise)

Put this in `/etc/init/solr.conf`:

```
start on runlevel [2345]
stop on runlevel [!2345]

kill timeout 30
respawn

setuid solr
setgid solr

script
   chdir /home/solr
   exec /usr/bin/java -jar start.jar
end script
```

Big thanks to [Eric Wilson's blog](http://ericwilson.erics.ws/snippets/2013/4/6/upstart-script-for-solr) for the initial script. I tweaked it for my specific user/group/location desires.
