sync: Dataforth sync fixes, TestDataDB stability, and client scripts
Dataforth DOS: - TestDataDB: singleton DB connection fix (crash prevention), WAL mode, WinSW service config, backup script, uncaught exception handlers - Sync-FromNAS.ps1: Get-NASFileList temp file approach to avoid SSH stdout deadlock, *> $null output suppression, 8.3 filename filter for PUSH phase, backslash-escaped SCP paths, rename-to-.synced - import.js: INSERT OR REPLACE for re-tested devices - Full import run: 1,028,275 -> 1,632,793 records, indexes added - Deploy script for sync fixes to AD2 Client scripts (temp/): - BG Builders: Lesley account check, MFA phone update - Lonestar Electrical: Kyla/Russ Google Workspace setup, 2FA bypass - AD2 diagnostics and NAS connectivity tests PENDING: Investigate why newest test_date is Jan 19 despite daily tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
51
projects/dataforth-dos/testdatadb-fix/install-service.js
Normal file
51
projects/dataforth-dos/testdatadb-fix/install-service.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Install TestDataDB as a Windows Service
|
||||
*
|
||||
* Uses node-windows to register the server as a persistent service
|
||||
* with automatic restart on crash.
|
||||
*
|
||||
* Run: node install-service.js
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const Service = require('node-windows').Service;
|
||||
|
||||
const svc = new Service({
|
||||
name: 'TestDataDB',
|
||||
description: 'Dataforth Test Data Database Server',
|
||||
script: path.join(__dirname, 'server.js'),
|
||||
nodeOptions: [],
|
||||
workingDirectory: __dirname,
|
||||
allowServiceLogon: true,
|
||||
// Restart configuration: max 3 restarts with 5-second delay
|
||||
maxRestarts: 3,
|
||||
maxRetries: 3,
|
||||
wait: 5,
|
||||
grow: 0.5
|
||||
});
|
||||
|
||||
// Set log directory
|
||||
svc.logpath = path.join('C:', 'Shares', 'testdatadb', 'logs');
|
||||
|
||||
svc.on('install', () => {
|
||||
console.log('[OK] TestDataDB service installed successfully.');
|
||||
console.log('[INFO] Starting service...');
|
||||
svc.start();
|
||||
});
|
||||
|
||||
svc.on('start', () => {
|
||||
console.log('[OK] TestDataDB service started.');
|
||||
});
|
||||
|
||||
svc.on('alreadyinstalled', () => {
|
||||
console.log('[WARNING] TestDataDB service is already installed.');
|
||||
console.log('[INFO] To reinstall, run uninstall-service.js first.');
|
||||
});
|
||||
|
||||
svc.on('error', (err) => {
|
||||
console.error('[ERROR] Service installation failed:', err);
|
||||
});
|
||||
|
||||
console.log('[INFO] Installing TestDataDB as a Windows service...');
|
||||
console.log('[INFO] Log directory: C:\\Shares\\testdatadb\\logs\\');
|
||||
svc.install();
|
||||
Reference in New Issue
Block a user