ci-server-engineer/examples/CI-Eng-Sample/shared/clean_dss_tmp.ps1
cliu 39e58af2ff R1.05 V4: reduced CI-Eng-Sample load tested and removed on shared server
Classes, sub-items, Modbus loopback and OPC UA loopback pass on R1.05.
New examples/CI-Eng-Sample/shared/: snapshot, reduced load/remove,
test and DSS temp-file cleanup scripts for shared servers. Before/after
snapshot identical; ISS-091 (dss_*.tmp left in tls\lst); ISS-080 note.
Certificate files of the test await deletion by the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 19:10:26 +11:00

15 lines
1,005 B
PowerShell

# Remove the DSS temporary files that a test session left in %TLS_LST_PATH%.
# Each dssqld run can leave a 0-byte dss_<n>_<id>.tmp there, and loading a class leaves its source
# text in one (verified on R1.05, 2026-10-08). Only files written since -Since are touched: 0-byte
# files, and non-empty files that contain sample text (CIENG / CI-Eng-Sample). Files in use are skipped.
# Usage: powershell -NoProfile -ExecutionPolicy Bypass -File clean_dss_tmp.ps1 -Since "2026-10-08T07:00:00"
param([Parameter(Mandatory = $true)][datetime]$Since)
$lst = $env:TLS_LST_PATH
$f = Get-ChildItem -Path $lst -Filter 'dss_*.tmp' | Where-Object { $_.LastWriteTime -ge $Since }
$ok = 0; $skip = 0
foreach ($i in $f) {
$mine = ($i.Length -eq 0) -or (Select-String -LiteralPath $i.FullName -Pattern 'CIENG|CI-Eng-Sample' -Quiet)
if (-not $mine) { $skip++; continue }
try { Remove-Item -LiteralPath $i.FullName -ErrorAction Stop; $ok++ } catch { $skip++ }
}
"deleted $ok, left $skip (other content or in use)"