Skip to content

Commit 801ce7c

Browse files
committed
Rotate maintenance log before performing action
1 parent 772f7a5 commit 801ce7c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/powershell/maintenance.ps1

Lines changed: 7 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 {
@@ -203,6 +209,7 @@ switch ($Action) {
203209

204210
"RotateLogs" {
205211
Stop-AllServices -Services $Services -TimeoutSeconds $startStopTimeoutSeconds
212+
Rotate-LogFile -LogFile $maintenanceLogFile -RetainCount 5
206213
Rotate-ServiceLogs -Services $services -LogsDir $logsDir
207214
Start-AllServices -Services $Services -TimeoutSeconds $startStopTimeoutSeconds
208215
}

0 commit comments

Comments
 (0)