Skip to content

Commit f246e23

Browse files
committed
Rotate maintenance log before performing action
1 parent 502eed0 commit f246e23

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/powershell/maintenance.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ param(
99
$logsDir = Join-Path $BaseInstallPath "logs"
1010
$maintenanceLogFile = Join-Path $logsDir "maintenance.log"
1111

12+
if (-not (Test-Path $logsDir)) {
13+
New-Item -Path $logsDir -ItemType Directory -Force | Out-Null
14+
}
15+
16+
17+
1218
$services = Get-Service |
1319
Where-Object { $_.Name -like "Gateway-*" } |
1420
ForEach-Object {
@@ -199,6 +205,8 @@ function Archive-PACS {
199205

200206
$startStopTimeoutSeconds = 30
201207

208+
Rotate-LogFile -LogFile $maintenanceLogFile -RetainCount 5
209+
202210
switch ($Action) {
203211

204212
"RotateLogs" {

0 commit comments

Comments
 (0)