File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,4 @@ global.json
1616* .g.json
1717* .g.ps1
1818scripts /build-agents /last-execution.txt
19+ * .log
Original file line number Diff line number Diff line change 1+ param (
2+ [switch ]$Inner
3+ )
4+
15$ErrorActionPreference = ' Stop'
26
37# Get the script's directory
48$scriptDir = $PSScriptRoot
59$lastExecutionFile = Join-Path $scriptDir " last-execution.txt"
10+ $executionLogFile = Join-Path $scriptDir " Daily-Maintenance.log"
11+
12+ # If -Inner is not specified, call this script with -Inner and use Tee-Object for logging
13+ if (-not $Inner ) {
14+ & $PSCommandPath - Inner 2>&1 | Tee-Object - FilePath $executionLogFile - Append
15+ exit $LASTEXITCODE
16+ }
17+
18+ $timestamp = Get-Date - Format " yyyy-MM-dd HH:mm:ss"
19+ Write-Host " [$timestamp ] === Daily Maintenance Script Started ==="
20+
621
722# Check if the script has been executed in the last 24 hours
823$shouldExecute = $true
You can’t perform that action at this time.
0 commit comments