Moved wDayzManager logs rotation.
Moved wDayzManager logs rotation from servers start loop to outside.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# wDayzManager v0.1
|
||||
# wDayzManager v0.2
|
||||
# Copyright (c) 2024 Vladislav Salikov aka W0LF aka 'dreamforce'
|
||||
# https://github.com/dreamforceinc
|
||||
# Required module: PSIni
|
||||
@@ -226,6 +226,17 @@ if ($rotateLogs) {
|
||||
$daysAmount = [Math]::Abs($config.daysAmount)
|
||||
if (-not ([string]::IsNullOrEmpty($config.rotatedLogsFolderName))) {
|
||||
$rotatedLogsFolderName = $config.rotatedLogsFolderName
|
||||
|
||||
Write-Host "Removing old wDayzManager logs..."
|
||||
$fileList = $null
|
||||
$fileList = Get-ChildItem -Path $currentPath\*.log -Recurse | Where-Object { $_.LastWriteTime.Date -lt $date.AddDays( -3) }
|
||||
# Write-Host $fileList -Separator "`n"
|
||||
foreach ($file in $fileList) {
|
||||
Remove-Item -Path $file
|
||||
Write-Host "Removed $($file)!"
|
||||
}
|
||||
Write-Host "Total: $($fileList.Count)"
|
||||
Write-Host
|
||||
}
|
||||
else {
|
||||
Write-Error "The 'rotatedLogsFolderName' parameter not set!"
|
||||
@@ -436,20 +447,6 @@ foreach ($srv in $servers) {
|
||||
Write-Host
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ### wDayzManager ###
|
||||
Write-Host "Removing old wDayzManager logs..."
|
||||
|
||||
$fileList = $null
|
||||
$fileList = Get-ChildItem -Path $currentPath\*.log -Recurse | Where-Object { $_.LastWriteTime.Date -lt $date.AddDays( -3) }
|
||||
# Write-Host $fileList -Separator "`n"
|
||||
foreach ($file in $fileList) {
|
||||
Remove-Item -Path $file
|
||||
Write-Host "Removed $($file)!"
|
||||
}
|
||||
Write-Host "Total: $($fileList.Count)"
|
||||
Write-Host
|
||||
#endregion
|
||||
}
|
||||
|
||||
# Write-Host " instance: $($instance)"
|
||||
|
||||
Reference in New Issue
Block a user