Pour pouvoir lancer l’instance Solr d’eZ Find (extension eZ Publish) au démarrage de votre serveur Debian, voici le script /etc/init.d/solr à mettre en place :

### BEGIN INIT INFO
# Provides:          solr
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the solr server
# Description:       starts solr using start-stop-daemon
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=solr
DESC=Solr

USER=solr
GROUP=solr
SOLR_HOME=/usr/local/solr
PARAMETERS="-jar start.jar"
DAEMON=/usr/bin/java
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

test -x $DAEMON || exit 0

set -e

. /lib/lsb/init-functions

d_start() {
 start-stop-daemon --start --pidfile $PIDFILE --chuid $USER:$GROUP --chdir $SOLR_HOME --background --make-pidfile --exec $DAEMON -- $PARAMETERS
}

d_stop() {
 start-stop-daemon --stop --quiet --pidfile $PIDFILE --name java
 rm -f $PIDFILE
}

d_status() {
 if [ -f "$PIDFILE" ] && ps `cat $PIDFILE` >/dev/null 2>&1; then
 return 0
 else
 return 1
 fi
}

case "$1" in
 start)
 echo -n "Starting $DESC: "
 if d_status; then
 echo "$NAME is already running."
 exit 1
 fi
 d_start
 sleep 1
 if d_status; then
 echo "OK"
 else
 echo "KO"
 exit 1
 fi
 ;;
 stop)
 echo -n "Stopping $DESC: "
 if d_status; then
 d_stop
 sleep 1
 if d_status; then
 echo "$NAME is still running"
 exit 1
 else
 echo "OK"
 fi
 else
 echo " KO"
 fi
 ;;
status)
 if d_status; then
 echo "$NAME is running (PID: `cat $PIDFILE`)"
 else
 echo "$NAME is not running"
 fi
 ;;
 restart|force-reload)
 echo -n "Restarting $DESC"
 d_stop
 sleep 1
 d_start
 echo "."
 ;;
 *)
 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
 exit 1
 ;;
esac

exit 0

L’installation du serveur Jetty + Solr est effectuée dans /usr/local/src et l’utilisateur solr est utilisé pour exécuter le serveur. Reste à activer la prise en charge du script :

# update-rc.d solr defaults