Solr running on Windows2012r2 under task scheduler

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Solr running on Windows2012r2 under task scheduler

Phillip Wu
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?