1
0
mirror of https://github.com/djohnlewis/stackdump synced 2024-12-04 23:17:37 +00:00
stackdump/Start-Solr.ps1

31 lines
1.8 KiB
PowerShell
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<#
.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."
}