Files
claudetools/clients/dataforth/scripts/check-db-server.ps1
Mike Swanson 5cbd49ce24 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>
2026-03-20 17:15:07 -07:00

73 lines
2.6 KiB
PowerShell

# Check Node.js server status and database access on AD2
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
Write-Host "[OK] Checking Node.js server status..." -ForegroundColor Green
# Check if Node.js process is running
$nodeProcs = Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
Get-Process node -ErrorAction SilentlyContinue | Select-Object Id, ProcessName, StartTime, @{Name='Memory(MB)';Expression={[math]::Round($_.WorkingSet64/1MB,2)}}
}
if ($nodeProcs) {
Write-Host "[FOUND] Node.js process(es) running:" -ForegroundColor Green
$nodeProcs | Format-Table -AutoSize
} else {
Write-Host "[WARNING] No Node.js process found - server may not be running" -ForegroundColor Yellow
}
# Check database file
Write-Host "`n[OK] Checking database file..." -ForegroundColor Green
$dbInfo = Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$dbPath = "C:\Shares\testdatadb\database\testdata.db"
if (Test-Path $dbPath) {
$file = Get-Item $dbPath
[PSCustomObject]@{
Exists = $true
Size = [math]::Round($file.Length/1MB,2)
LastWrite = $file.LastWriteTime
Readable = $true
}
} else {
[PSCustomObject]@{
Exists = $false
}
}
}
if ($dbInfo.Exists) {
Write-Host "[OK] Database file found" -ForegroundColor Green
Write-Host " Size: $($dbInfo.Size) MB" -ForegroundColor Cyan
Write-Host " Last Modified: $($dbInfo.LastWrite)" -ForegroundColor Cyan
} else {
Write-Host "[ERROR] Database file not found!" -ForegroundColor Red
}
# Check for server log file
Write-Host "`n[OK] Checking for server logs..." -ForegroundColor Green
$logs = Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$logPath = "C:\Shares\testdatadb\server.log"
if (Test-Path $logPath) {
Get-Content $logPath -Tail 20
} else {
Write-Output "[INFO] No server.log file found"
}
}
if ($logs) {
Write-Host "[OK] Recent server logs:" -ForegroundColor Green
$logs | ForEach-Object { Write-Host " $_" }
}
# Try to test port 3000
Write-Host "`n[OK] Testing port 3000..." -ForegroundColor Green
$portTest = Test-NetConnection -ComputerName 192.168.0.6 -Port 3000 -WarningAction SilentlyContinue
if ($portTest.TcpTestSucceeded) {
Write-Host "[OK] Port 3000 is open and accessible" -ForegroundColor Green
} else {
Write-Host "[ERROR] Port 3000 is not accessible - server may not be running" -ForegroundColor Red
}
Write-Host "`n[OK] Done" -ForegroundColor Green