Beta_cartrigesg_bd Beta v0.10

This commit is contained in:
2026-07-28 20:39:14 +03:00
parent 12fc229907
commit 5f7e4efbae
26 changed files with 690 additions and 33 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

View File

@@ -0,0 +1,68 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$ExecutablePath
)
$ErrorActionPreference = 'Stop'
$serviceName = 'InventeraServer'
$displayName = 'Inventera Server'
$description = 'Автоматически запускает веб-сервер Inventera при старте Windows.'
$postgresServiceName = 'InventeraPostgreSQL18'
if (-not (Test-Path -LiteralPath $ExecutablePath -PathType Leaf)) {
throw "Не найден исполняемый файл службы: $ExecutablePath"
}
$quotedExecutablePath = '"' + $ExecutablePath + '"'
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if ($null -eq $service) {
New-Service `
-Name $serviceName `
-BinaryPathName $quotedExecutablePath `
-DisplayName $displayName `
-Description $description `
-StartupType Automatic | Out-Null
}
else {
if ($service.Status -ne 'Stopped') {
Stop-Service -Name $serviceName -Force
$service.WaitForStatus('Stopped', [TimeSpan]::FromSeconds(30))
}
& sc.exe config $serviceName 'binPath=' $quotedExecutablePath 'start=' 'auto' | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Не удалось обновить службу $serviceName. Код ошибки: $LASTEXITCODE"
}
& sc.exe description $serviceName $description | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Не удалось обновить описание службы. Код ошибки: $LASTEXITCODE"
}
}
& sc.exe failure $serviceName 'reset=' '86400' 'actions=' 'restart/60000/restart/60000/restart/60000' | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Не удалось настроить перезапуск службы. Код ошибки: $LASTEXITCODE"
}
& sc.exe failureflag $serviceName '1' | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Не удалось включить действия при ошибке службы. Код ошибки: $LASTEXITCODE"
}
if ($null -ne (Get-Service -Name $postgresServiceName -ErrorAction SilentlyContinue)) {
& sc.exe config $serviceName 'depend=' $postgresServiceName | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Не удалось настроить зависимость от PostgreSQL. Код ошибки: $LASTEXITCODE"
}
}
Start-Service -Name $serviceName
(Get-Service -Name $serviceName).WaitForStatus(
'Running',
[TimeSpan]::FromSeconds(30)
)
Write-Host 'Служба Inventera установлена и запущена.'

View File

@@ -26,6 +26,10 @@ param(
[ValidateRange(1, 65535)]
[int]$ApplicationPort,
[Parameter(Mandatory = $false)]
[ValidateSet('full', 'cartridge')]
[string]$Edition = 'full',
[Parameter(Mandatory = $true)]
[string]$ConfigPath
)
@@ -213,6 +217,7 @@ $configDirectory = Split-Path -Parent $ConfigPath
New-Item -ItemType Directory -Path $configDirectory -Force | Out-Null
$config = [ordered]@{
edition = $Edition
database = [ordered]@{
host = '127.0.0.1'
port = $PostgreSqlPort