Reorganize repo: compartmentalize scripts by client/project
Move 150+ scripts from root and scripts/ into client/project directories: - clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts) - clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination) - clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups) - projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto) - projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts) - clients/glaztech/scripts/ (1 file: CentraStage removal) Also reorganized: - VPN scripts → infrastructure/vpn-configs/ - Retrieved API/JS files → api/ - Forum posts → projects/community-forum/forum-posts/ - SSH docs → clients/internal-infrastructure/docs/ - NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/ - ACG website files → projects/internal/acg-website-2025/ - Dataforth docs → clients/dataforth/docs/ - schema-retrieved.sql → docs/database/ Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history). Root reduced from 220+ files to 62 items (docs + directories only). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
98
clients/dataforth/scripts/monitor-next-sync.ps1
Normal file
98
clients/dataforth/scripts/monitor-next-sync.ps1
Normal file
@@ -0,0 +1,98 @@
|
||||
# Monitor the next scheduled sync run to verify the fix
|
||||
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
|
||||
|
||||
Write-Host "=== Monitoring Next Sync Run ===" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
||||
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
|
||||
|
||||
Write-Host "[1] Current time: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Yellow
|
||||
Write-Host "[2] Scheduled task runs every 15 minutes" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
# Get current log size
|
||||
$initialSize = (Get-Item $logFile).Length
|
||||
Write-Host "[3] Waiting for next sync run..." -ForegroundColor Cyan
|
||||
Write-Host " (watching log file for new entries)" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
# Wait for new log entries (max 16 minutes)
|
||||
$timeout = 960 # 16 minutes in seconds
|
||||
$elapsed = 0
|
||||
$newContent = $null
|
||||
|
||||
while ($elapsed -lt $timeout) {
|
||||
Start-Sleep -Seconds 10
|
||||
$elapsed += 10
|
||||
|
||||
$currentSize = (Get-Item $logFile).Length
|
||||
|
||||
if ($currentSize -gt $initialSize) {
|
||||
# New content detected
|
||||
Write-Host "[OK] New sync activity detected!" -ForegroundColor Green
|
||||
Start-Sleep -Seconds 30 # Wait for sync to complete
|
||||
break
|
||||
}
|
||||
|
||||
# Show progress
|
||||
$remaining = [math]::Round(($timeout - $elapsed) / 60, 1)
|
||||
Write-Host " Waiting... ($remaining minutes until timeout)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
if ($currentSize -eq $initialSize) {
|
||||
Write-Host "[WARNING] No new sync activity within timeout period" -ForegroundColor Yellow
|
||||
Write-Host "Showing last 20 lines of existing log:" -ForegroundColor Gray
|
||||
Get-Content $logFile -Tail 20 | ForEach-Object {
|
||||
if ($_ -match "ERROR|error") {
|
||||
Write-Host " $_" -ForegroundColor Red
|
||||
} else {
|
||||
Write-Host " $_" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[4] Analyzing new log entries" -ForegroundColor Yellow
|
||||
Write-Host "=" * 80 -ForegroundColor Gray
|
||||
|
||||
# Get all content and extract the new portion
|
||||
$allContent = Get-Content $logFile -Raw
|
||||
$newBytes = $currentSize - $initialSize
|
||||
$newContent = $allContent.Substring([math]::Max(0, $allContent.Length - $newBytes - 1000))
|
||||
|
||||
# Show new log entries
|
||||
$newContent -split "`n" | Select-Object -Last 50 | ForEach-Object {
|
||||
if ($_ -match "SCP ERROR|ERROR.*push|ERROR.*pull") {
|
||||
Write-Host " $_" -ForegroundColor Red
|
||||
} elseif ($_ -match "Pushed:|Pulled:") {
|
||||
Write-Host " $_" -ForegroundColor Green
|
||||
} elseif ($_ -match "Starting sync|sync complete") {
|
||||
Write-Host " $_" -ForegroundColor Cyan
|
||||
} else {
|
||||
Write-Host " $_" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[5] Error summary" -ForegroundColor Yellow
|
||||
Write-Host "=" * 80 -ForegroundColor Gray
|
||||
|
||||
$scpErrors = $newContent -split "`n" | Select-String -Pattern "SCP ERROR"
|
||||
|
||||
if ($scpErrors) {
|
||||
Write-Host "[FOUND] SCP errors in this sync run:" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
$scpErrors | ForEach-Object {
|
||||
Write-Host " $_" -ForegroundColor Red
|
||||
}
|
||||
} else {
|
||||
Write-Host "[SUCCESS] No SCP errors found in this sync run!" -ForegroundColor Green
|
||||
Write-Host "The known_hosts path fix appears to be working." -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== Monitoring Complete ===" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user