Files
claudetools/clients/dataforth/scripts/check-db-simple.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

78 lines
3.2 KiB
PowerShell

# Simple check of database server via SMB
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
Write-Host "[OK] Mounting AD2 C$ share..." -ForegroundColor Green
New-PSDrive -Name AD2 -PSProvider FileSystem -Root "\\192.168.0.6\C$" -Credential $cred -ErrorAction Stop | Out-Null
Write-Host "[OK] Checking database file..." -ForegroundColor Green
$dbPath = "AD2:\Shares\testdatadb\database\testdata.db"
if (Test-Path $dbPath) {
$dbFile = Get-Item $dbPath
Write-Host "[OK] Database file exists" -ForegroundColor Green
Write-Host " Size: $([math]::Round($dbFile.Length/1MB,2)) MB" -ForegroundColor Cyan
Write-Host " Last Modified: $($dbFile.LastWriteTime)" -ForegroundColor Cyan
# Check if file is locked
try {
$stream = [System.IO.File]::Open($dbFile.FullName, 'Open', 'Read', 'Read')
$stream.Close()
Write-Host " [OK] Database file is accessible (not locked)" -ForegroundColor Green
} catch {
Write-Host " [WARNING] Database file may be locked: $($_.Exception.Message)" -ForegroundColor Yellow
}
} else {
Write-Host "[ERROR] Database file not found!" -ForegroundColor Red
}
# Check server.js file
Write-Host "`n[OK] Checking server files..." -ForegroundColor Green
$serverPath = "AD2:\Shares\testdatadb\server.js"
if (Test-Path $serverPath) {
Write-Host "[OK] server.js exists" -ForegroundColor Green
} else {
Write-Host "[ERROR] server.js not found!" -ForegroundColor Red
}
# Check package.json
$packagePath = "AD2:\Shares\testdatadb\package.json"
if (Test-Path $packagePath) {
Write-Host "[OK] package.json exists" -ForegroundColor Green
$package = Get-Content $packagePath -Raw | ConvertFrom-Json
Write-Host " Dependencies:" -ForegroundColor Cyan
$package.dependencies.PSObject.Properties | ForEach-Object {
Write-Host " - $($_.Name): $($_.Value)" -ForegroundColor Cyan
}
}
# Check for any error log files
Write-Host "`n[OK] Checking for error logs..." -ForegroundColor Green
$logFiles = Get-ChildItem "AD2:\Shares\testdatadb\*.log" -ErrorAction SilentlyContinue
if ($logFiles) {
Write-Host "[FOUND] Log files:" -ForegroundColor Green
$logFiles | ForEach-Object {
Write-Host " $($_.Name) - $([math]::Round($_.Length/1KB,2)) KB - Modified: $($_.LastWriteTime)" -ForegroundColor Cyan
if ($_.Length -lt 10KB) {
Write-Host " Last 10 lines:" -ForegroundColor Yellow
Get-Content $_.FullName -Tail 10 | ForEach-Object { Write-Host " $_" -ForegroundColor Gray }
}
}
} else {
Write-Host "[INFO] No log files found" -ForegroundColor Cyan
}
# Test port 3000
Write-Host "`n[OK] Testing port 3000 connectivity..." -ForegroundColor Green
$portTest = Test-NetConnection -ComputerName 192.168.0.6 -Port 3000 -WarningAction SilentlyContinue -InformationLevel Quiet
if ($portTest) {
Write-Host "[OK] Port 3000 is OPEN" -ForegroundColor Green
} else {
Write-Host "[ERROR] Port 3000 is CLOSED - Server not running or firewall blocking" -ForegroundColor Red
}
Remove-PSDrive -Name AD2 -ErrorAction SilentlyContinue
Write-Host "`n[OK] Done" -ForegroundColor Green