You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Phillip Wu <ph...@unsw.edu.au> on 2017/10/09 04:46:53 UTC

Solr running on Windows2012r2 under task scheduler

Hi,
I'm trying to run Solr 7.0.0 on Windows 2012r2 like a unix daemon.

I'd though I'd do this by running the commands to start Solr interactively as a task scheduler job. If I don't do this then
when I log out of the server Windows stops any running processes.

I'm running Solr sucessfully from the command line (cmd) as follows:
cd C:\temp\solr-7.0.0
bin\solr start -noprompt

I've written this script for task scheduler which I call mysolr.cmd:
rem check for program (Solr) listening for port 8983
@echo off
netstat -o -n -a | findstr 8983
if %ERRORLEVEL% equ 0 goto alreadyrun
@echo on
cd c:\solr-7.0.0
bin\solr start -noprompt
goto endscript

:alreadyrun
echo Solr already running
:endscript
exit /b 0

I put this into task scheduler:
"Run when user logged in or not"
"Run with the highest privledges"
"Program/Script": cmd
"Add arguments (optional)" : C:\solr-7.0.0\mysolr.cmd
"Start in": C:\solr-7.0.0

I've also tried to run Solr as a service using NSSM:
http://coding-art.blogspot.com.au/2016/07/running-solr-61-as-windows-service.html

but this does not work either.

Any ideas of how to fix the task scheduler job?