Hi, 

I've successfully used procrun (see 
http://commons.apache.org/proper/commons-daemon/procrun.html) to wrap Solr 5.1 
solr.cmd script as a Windows service (I’ve only tested on Windows 2008 R2). 
Previously, I was using Procrun to manage Jetty services running the Solr.war 
from older versions but with a bit a tweaking, I was able to wrap the new Solr 
5.1.0 scripts.

I roughly did the following:
-download and unzip the Solr 5.1.0 distribution to a local folder (i.e. c:\opt )
-download and unzip the Apache Commons Daemon .zip file (from 
http://commons.apache.org/proper/commons-daemon/download_daemon.cgi) in my solr 
local folder (i.e. c:\opt\solr-5.1.0)
-run the batch file [1].

All of this was done through Ansible Playbooks which is the tool I use for 
configuration management on Windows and Linux.

Cheers, 

Guillaume.

[1] 
@echo off
set SERVICE_NAME=solr
set SERVICE_HOME=c:\opt\solr-5.1.0
set PR_INSTALL=%SERVICE_HOME%\amd64\prunsrv.exe

@REM Service Log Configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=%SERVICE_HOME%\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_LOGLEVEL=Debug

set PR_STARTUP=auto
set PR_STARTMODE=exe
set PR_STARTIMAGE=%SERVICE_HOME%\bin\solr.cmd
set PR_STARTPARAMS=start

@REM Shutdown Configuration
set PR_STOPMODE=exe
set PR_STOPIMAGE=%SERVICE_HOME%\bin\solr.cmd
set PR_STOPPARAMS=stop -p 8983

%PR_INSTALL% //IS/%SERVICE_NAME% ^
  --Description="Solr-5.1.0" ^
  --DisplayName="%SERVICE_NAME%" ^
  --Install="%PR_INSTALL%" ^
  --Startup="%PR_STARTUP%" ^
  --LogPath="%PR_LOGPATH%" ^
  --LogPrefix="%PR_LOGPREFIX%" ^
  --LogLevel="%PR_LOGLEVEL%" ^
  --StdOutput="%PR_STDOUTPUT%" ^
  --StdError="%PR_STDERROR%" ^
  --StartMode="%PR_STARTMODE%" ^
  --StartImage="%PR_STARTIMAGE%" ^
  --StartParams="%PR_STARTPARAMS%" ^
  --StopMode="%PR_STOPMODE%" ^
  --StopImage="%PR_STOPIMAGE%" ^
  --StopParams="%PR_STOPPARAMS%"

if not errorlevel 1 goto installed
echo Failed to install "%SERVICE_NAME%" service.  Refer to log in %PR_LOGPATH%
exit /B 1

:installed
echo The Service "%SERVICE_NAME%" has been installed
exit /B 0
---------------------------------------------------------------------------------------
This email has been scanned for email related threats and delivered safely by 
Mimecast.
For more information please visit http://www.mimecast.com
---------------------------------------------------------------------------------------

Reply via email to