Initialer Commit
This commit is contained in:
22
scripts/install-service.ps1
Normal file
22
scripts/install-service.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
param(
|
||||
[string]$InstallDir = "C:\printservice-app",
|
||||
[string]$ConfigDir = "C:\printservice",
|
||||
[int]$Port = 8080,
|
||||
[string]$Jar = "$PSScriptRoot\..\target\printservice-standalone.jar"
|
||||
)
|
||||
New-Item -ItemType Directory -Force -Path $InstallDir, "$InstallDir\logs", $ConfigDir | Out-Null
|
||||
Copy-Item $Jar "$InstallDir\printservice-standalone.jar" -Force
|
||||
Copy-Item "$PSScriptRoot\..\service\printservice.xml" "$InstallDir\printservice.xml" -Force
|
||||
(Get-Content "$InstallDir\printservice.xml") `
|
||||
-replace 'C:\\printservice', ($ConfigDir -replace '\\','\\') `
|
||||
-replace '--port=8080', "--port=$Port" | Set-Content "$InstallDir\printservice.xml" -Encoding UTF8
|
||||
Write-Host "Bitte WinSW-x64.exe als $InstallDir\printservice.exe ablegen, falls noch nicht vorhanden."
|
||||
if (Test-Path "$InstallDir\printservice.exe") {
|
||||
Push-Location $InstallDir
|
||||
.\printservice.exe install
|
||||
.\printservice.exe start
|
||||
Pop-Location
|
||||
} else {
|
||||
Write-Host "Download WinSW, benenne es in printservice.exe um und fuehre danach aus:"
|
||||
Write-Host "cd $InstallDir; .\printservice.exe install; .\printservice.exe start"
|
||||
}
|
||||
Reference in New Issue
Block a user