1
0
mirror of https://github.com/djohnlewis/stackdump synced 2025-01-22 22:51:36 +00:00
stackdump/Start-Solr.ps1

31 lines
1.8 KiB
PowerShell
Raw Normal View History

<EFBFBD><EFBFBD><#
.SYNOPSIS
Starts Solr, the Stackdump indexing engine.
.DESCRIPTION
Starts Solr, by using the Java path specified in the JAVA_CMD file located in
the same directory as this script (create as necessary) or java.exe that
resolves in the current PATH.
No parameters are accepted.
.EXAMPLE
Start-Solr
#>
$ScriptDir = Split-Path $MyInvocation.MyCommand.Path
$JavaCmd = 'java.exe'
if (Test-Path (Join-Path $ScriptDir 'JAVA_CMD')) {
$JavaCmd = Get-Content (Join-Path $ScriptDir 'JAVA_CMD')
}
$AbsJavaCmd = @(Get-Command $JavaCmd -ErrorAction SilentlyContinue)[0].Path
if ($AbsJavaCmd -ne $null) {
Write-Host "Using Java $AbsJavaCmd"
cd (Join-Path $ScriptDir 'java\solr\server')
& $AbsJavaCmd -Xmx2048M -XX:MaxPermSize=512M -jar start.jar
}
else {
Write-Error "Java could not be located. Specify its path using JAVA_CMD or check the path in JAVA_CMD."
}