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"
|
||||
}
|
||||
6
scripts/start-console.bat
Normal file
6
scripts/start-console.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set BASE=%~dp0..
|
||||
if not defined PRINTSERVICE_CONFIG_DIR set PRINTSERVICE_CONFIG_DIR=C:\printservice
|
||||
if not defined PRINTSERVICE_PORT set PRINTSERVICE_PORT=8080
|
||||
java -Dprintservice.config.dir=%PRINTSERVICE_CONFIG_DIR% -jar "%BASE%\target\printservice-standalone.jar" --host=0.0.0.0 --port=%PRINTSERVICE_PORT%
|
||||
6
scripts/start-console.ps1
Normal file
6
scripts/start-console.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
param(
|
||||
[string]$ConfigDir = "C:\printservice",
|
||||
[int]$Port = 8080,
|
||||
[string]$Jar = "$PSScriptRoot\..\target\printservice-standalone.jar"
|
||||
)
|
||||
java "-Dprintservice.config.dir=$ConfigDir" -jar $Jar --host=0.0.0.0 --port=$Port
|
||||
9
scripts/uninstall-service.ps1
Normal file
9
scripts/uninstall-service.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
param([string]$InstallDir = "C:\printservice-app")
|
||||
Push-Location $InstallDir
|
||||
if (Test-Path ".\printservice.exe") {
|
||||
.\printservice.exe stop
|
||||
.\printservice.exe uninstall
|
||||
} else {
|
||||
Write-Host "printservice.exe nicht gefunden. WinSW-Datei pruefen."
|
||||
}
|
||||
Pop-Location
|
||||
Reference in New Issue
Block a user