Demon for solr

I would like to run solr with a demon. I saw in another post that there is an init.d script that you can run, but it looks like I'm having problems in my ubuntu environment. when I try to run a script with the start of /etc/init.d/solr or when I try to run the bottom line manually:

daemon java -jar start.jar 

these are errors:

 daemon: invalid option -- 'j' 

Any ideas? THX

+2
daemon solr
Dec 12 2018-10-12T00:
source share
3 answers

Below is a working script for demonizing Solr. Observe important notes here:

  • You need to install chdir for the daemon script, otherwise you will get errors when loading the configuration file.
  • This will allow you to start / stop / status / restart Solr.
  • This is a simple version that works for me.

Here's the script:

 #!/bin/sh # Prerequisites: # 1. Solr needs to be installed at /usr/local/solr/example # 2. daemon needs to be installed # 3. Script needs to be executed by root # This script will launch Solr in a mode that will automatically respawn if it # crashes. Output will be sent to /var/log/solr/solr.log. A pid file will be # created in the standard location. start () { echo -n "Starting solr..." # start daemon daemon --chdir='/usr/local/solr/example' --command "java -jar start.jar" --respawn --output=/var/log/solr/solr.log --name=solr --verbose RETVAL=$? if [ $RETVAL = 0 ] then echo "done." else echo "failed. See error code for more information." fi return $RETVAL } stop () { # stop daemon echo -n "Stopping solr..." daemon --stop --name=solr --verbose RETVAL=$? if [ $RETVAL = 0 ] then echo "done." else echo "failed. See error code for more information." fi return $RETVAL } restart () { daemon --restart --name=solr --verbose } status () { # report on the status of the daemon daemon --running --verbose --name=solr return $? } case "$1" in start) start ;; status) status ;; stop) stop ;; restart) restart ;; *) echo $"Usage: solr {start|status|stop|restart}" exit 3 ;; esac exit $RETVAL 
+8
Nov 18 '11 at 21:20
source share

Cm:

  • How to unmount a Java program?
  • How to convert an existing Java application to SYS V service (daemon)
+1
Dec 12 '10 at 2:37
source share

Try the following:

 daemon `java -jar start.jar` 
-one
Sep 06 2018-11-11T00:
source share



All Articles