Fix cron auto-restart script - add Homebrew PATH

- Added /opt/homebrew/bin to PATH for npm access
- Use full path to npm (/opt/homebrew/bin/npm) for reliability
- Script tested and working
This commit is contained in:
Matt Bruce 2026-02-18 20:49:52 -06:00
parent b934c9fdb3
commit eb919244a0
12 changed files with 884 additions and 60 deletions

BIN
blog-backup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
gantt-board.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
heartbeat-monitor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
heartbeat-screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

6
logs/web-monitor.log Normal file
View File

@ -0,0 +1,6 @@
[2026-02-18 16:41:40 CST] Starting web app health check...
[2026-02-18 16:41:40 CST] ✓ gantt-board (port 3000) - HTTP 200 OK
[2026-02-18 16:41:40 CST] ✓ blog-backup (port 3003) - HTTP 200 OK
[2026-02-18 16:41:40 CST] ✓ heartbeat-monitor (port 3005) - HTTP 200 OK
[2026-02-18 16:41:40 CST] All apps healthy.
[2026-02-18 16:41:40 CST] ---

View File

@ -0,0 +1,77 @@
[2026-02-18 16:11:21] === Starting Web App Monitor Check ===
[2026-02-18 16:11:41] === Starting Web App Monitor Check ===
[2026-02-18 16:11:41] Checking port 3000 (gantt-board)...
[2026-02-18 16:11:41] ✓ Port 3000 (gantt-board) is responding HTTP 200
[2026-02-18 16:11:41] Checking port 3003 (blog-backup)...
[2026-02-18 16:11:41] ✓ Port 3003 (blog-backup) is responding HTTP 200
[2026-02-18 16:11:41] Checking port 3005 (heartbeat-monitor)...
[2026-02-18 16:11:41] ✓ Port 3005 (heartbeat-monitor) is responding HTTP 200
[2026-02-18 16:11:41] All apps are healthy. No restart needed.
[2026-02-18 16:11:41] === Monitor Check Complete ===
[2026-02-18 16:16:29] === Starting Web App Monitor Check ===
[2026-02-18 16:16:29] Checking port 3000 (gantt-board)...
[2026-02-18 16:16:29] ✓ Port 3000 (gantt-board) is responding HTTP 200
[2026-02-18 16:16:29] Checking port 3003 (blog-backup)...
[2026-02-18 16:16:29] ✓ Port 3003 (blog-backup) is responding HTTP 200
[2026-02-18 16:16:29] Checking port 3005 (heartbeat-monitor)...
[2026-02-18 16:16:29] ✓ Port 3005 (heartbeat-monitor) is responding HTTP 200
[2026-02-18 16:16:29] All apps are healthy. No restart needed.
[2026-02-18 16:16:29] === Monitor Check Complete ===
[2026-02-18 16:26:28] === Starting Web App Monitor Check ===
[2026-02-18 16:26:28] Checking port 3000 (gantt-board)...
[2026-02-18 16:26:29] ✓ Port 3000 (gantt-board) is responding HTTP 200
[2026-02-18 16:26:29] Checking port 3003 (blog-backup)...
[2026-02-18 16:26:29] ✓ Port 3003 (blog-backup) is responding HTTP 200
[2026-02-18 16:26:29] Checking port 3005 (heartbeat-monitor)...
[2026-02-18 16:26:29] ✗ Port 3005 (heartbeat-monitor) is DOWN or not responding
[2026-02-18 16:26:29] Found 1 app(s) needing restart
[2026-02-18 16:26:29] Restarting heartbeat-monitor on port 3005...
[2026-02-18 16:26:29] Killing processes on port 3005...
[2026-02-18 16:26:29] Waiting 2 seconds...
[2026-02-18 16:26:31] Starting npm run dev -- --port 3005...
[2026-02-18 16:26:31] heartbeat-monitor restarted in background
[2026-02-18 16:26:31] Waiting 5 seconds for apps to initialize...
[2026-02-18 16:26:36] === Verification Check ===
[2026-02-18 16:26:36] ✓ Port 3000 (gantt-board) - HTTP 200 OK
[2026-02-18 16:26:36] ✓ Port 3003 (blog-backup) - HTTP 200 OK
[2026-02-18 16:26:36] ✗ Port 3005 (heartbeat-monitor) - STILL DOWN
[2026-02-18 16:26:36] === WARNING: Some apps may still be down ===
[2026-02-18 16:26:36] Monitor check complete. Log: /Users/mattbruce/.openclaw/workspace/logs/webapp-monitor-20260218.log
[2026-02-18 16:29:16] === Starting Web App Monitor Check ===
[2026-02-18 16:29:16] Checking port 3000 (gantt-board)...
[2026-02-18 16:29:16] ✓ Port 3000 (gantt-board) is responding HTTP 200
[2026-02-18 16:29:16] Checking port 3003 (blog-backup)...
[2026-02-18 16:29:16] ✓ Port 3003 (blog-backup) is responding HTTP 200
[2026-02-18 16:29:16] Checking port 3005 (heartbeat-monitor)...
[2026-02-18 16:29:16] ✗ Port 3005 (heartbeat-monitor) is DOWN or not responding
[2026-02-18 16:29:16] Found 1 app(s) needing restart
[2026-02-18 16:29:16] Restarting heartbeat-monitor on port 3005...
[2026-02-18 16:29:16] Killing processes on port 3005...
[2026-02-18 16:29:17] Waiting 2 seconds...
[2026-02-18 16:29:19] Starting npm run dev -- --port 3005...
[2026-02-18 16:29:19] heartbeat-monitor restarted in background
[2026-02-18 16:29:19] Waiting 5 seconds for apps to initialize...
[2026-02-18 16:29:24] === Verification Check ===
[2026-02-18 16:29:24] ✓ Port 3000 (gantt-board) - HTTP 200 OK
[2026-02-18 16:29:24] ✓ Port 3003 (blog-backup) - HTTP 200 OK
[2026-02-18 16:29:24] ✗ Port 3005 (heartbeat-monitor) - STILL DOWN
[2026-02-18 16:29:24] === WARNING: Some apps may still be down ===
[2026-02-18 16:29:24] Monitor check complete. Log: /Users/mattbruce/.openclaw/workspace/logs/webapp-monitor-20260218.log
[2026-02-18 16:36:29] === Starting Web App Monitor Check ===
[2026-02-18 16:36:29] Checking port 3000 (gantt-board)...
[2026-02-18 16:36:29] ✓ Port 3000 (gantt-board) is responding HTTP 200
[2026-02-18 16:36:29] Checking port 3003 (blog-backup)...
[2026-02-18 16:36:29] ✓ Port 3003 (blog-backup) is responding HTTP 200
[2026-02-18 16:36:29] Checking port 3005 (heartbeat-monitor)...
[2026-02-18 16:36:29] ✓ Port 3005 (heartbeat-monitor) is responding HTTP 200
[2026-02-18 16:36:29] All apps are healthy. No restart needed.
[2026-02-18 16:36:29] === Monitor Check Complete ===
[2026-02-18 16:46:29] === Starting Web App Monitor Check ===
[2026-02-18 16:46:29] Checking port 3000 (gantt-board)...
[2026-02-18 16:46:29] ✓ Port 3000 (gantt-board) is responding HTTP 200
[2026-02-18 16:46:29] Checking port 3003 (blog-backup)...
[2026-02-18 16:46:29] ✓ Port 3003 (blog-backup) is responding HTTP 200
[2026-02-18 16:46:29] Checking port 3005 (heartbeat-monitor)...
[2026-02-18 16:46:29] ✓ Port 3005 (heartbeat-monitor) is responding HTTP 200
[2026-02-18 16:46:29] All apps are healthy. No restart needed.
[2026-02-18 16:46:29] === Monitor Check Complete ===

View File

@ -20,3 +20,525 @@
[2026-02-18 16:01:29 CST] ✓ heartbeat-monitor (port 3005) is UP [2026-02-18 16:01:29 CST] ✓ heartbeat-monitor (port 3005) is UP
[2026-02-18 16:01:29 CST] All apps healthy, no action needed [2026-02-18 16:01:29 CST] All apps healthy, no action needed
[2026-02-18 16:01:29 CST] === Monitor check complete === [2026-02-18 16:01:29 CST] === Monitor check complete ===
[2026-02-18 16:06:29 CST] === Starting web app monitor check ===
[2026-02-18 16:06:29 CST] ✓ gantt-board (port 3000) is UP
[2026-02-18 16:06:29 CST] ✓ blog-backup (port 3003) is UP
[2026-02-18 16:06:29 CST] ✓ heartbeat-monitor (port 3005) is UP
[2026-02-18 16:06:29 CST] All apps healthy, no action needed
[2026-02-18 16:06:29 CST] === Monitor check complete ===
[2026-02-18 16:32:11] Starting web app monitor check
[2026-02-18 16:32:32] Starting web app monitor check
[2026-02-18 16:32:32] gantt-board (port 3000) is UP
[2026-02-18 16:32:32] blog-backup (port 3003) is UP
[2026-02-18 16:32:32] heartbeat-monitor (port 3005) is DOWN - restarting...
[2026-02-18 16:32:34] Starting heartbeat-monitor on port 3005...
[2026-02-18 16:32:34] Waiting 5 seconds for apps to start...
[2026-02-18 16:32:39] Final verification:
[2026-02-18 16:32:39] ✓ gantt-board (port 3000) - UP
[2026-02-18 16:32:39] ✓ blog-backup (port 3003) - UP
[2026-02-18 16:32:39] ✗ heartbeat-monitor (port 3005) - STILL DOWN
[2026-02-18 16:32:39] WARNING: Some web apps failed to start
[2026-02-18 16:32:39] Monitor check complete
---
[2026-02-18 16:32:59] Starting web app monitor check
[2026-02-18 16:32:59] gantt-board (port 3000) is UP
[2026-02-18 16:32:59] blog-backup (port 3003) is UP
[2026-02-18 16:32:59] heartbeat-monitor (port 3005) is DOWN - restarting...
[2026-02-18 16:33:01] Starting heartbeat-monitor on port 3005...
[2026-02-18 16:33:01] Waiting 5 seconds for apps to start...
[2026-02-18 16:33:06] Final verification:
[2026-02-18 16:33:06] ✓ gantt-board (port 3000) - UP
[2026-02-18 16:33:06] ✓ blog-backup (port 3003) - UP
[2026-02-18 16:33:06] ✗ heartbeat-monitor (port 3005) - STILL DOWN
[2026-02-18 16:33:06] WARNING: Some web apps failed to start
[2026-02-18 16:33:06] Monitor check complete
---
[2026-02-18 16:42:10] Starting web app monitor check
[2026-02-18 16:42:10] gantt-board (port 3000) is UP
[2026-02-18 16:42:10] blog-backup (port 3003) is UP
[2026-02-18 16:42:10] heartbeat-monitor (port 3005) is UP
[2026-02-18 16:42:10] Final verification:
[2026-02-18 16:42:10] ✓ gantt-board (port 3000) - UP
[2026-02-18 16:42:10] ✓ blog-backup (port 3003) - UP
[2026-02-18 16:42:10] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 16:42:10] All web apps are running
[2026-02-18 16:42:10] Monitor check complete
---
[2026-02-18 16:42:30] Starting web app monitor check
[2026-02-18 16:42:50] Starting web app monitor check
[2026-02-18 16:42:50] gantt-board (port 3000) is UP
[2026-02-18 16:42:50] blog-backup (port 3003) is UP
[2026-02-18 16:42:50] heartbeat-monitor (port 3005) is UP
[2026-02-18 16:42:50] Final verification:
[2026-02-18 16:42:50] ✓ gantt-board (port 3000) - UP
[2026-02-18 16:42:50] ✓ blog-backup (port 3003) - UP
[2026-02-18 16:42:50] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 16:42:50] All web apps are running
[2026-02-18 16:42:50] Monitor check complete
---
[2026-02-18 17:01:32] === Monitor Check Started ===
[2026-02-18 17:01:33] gantt-board (port 3000) is UP ✓
[2026-02-18 17:01:33] blog-backup (port 3003) is UP ✓
[2026-02-18 17:01:33] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:01:33] === Monitor Check Complete ===
[2026-02-18 17:01:33]
[2026-02-18 17:02:54] === Monitor Check Started ===
[2026-02-18 17:02:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:02:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:02:54] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:02:54] === Monitor Check Complete ===
[2026-02-18 17:02:54]
[2026-02-18 17:03:54] === Monitor Check Started ===
[2026-02-18 17:03:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:03:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:03:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:03:55] === Monitor Check Complete ===
[2026-02-18 17:03:55]
[2026-02-18 17:04:55] === Monitor Check Started ===
[2026-02-18 17:04:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:04:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:04:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:04:55] === Monitor Check Complete ===
[2026-02-18 17:04:55]
[2026-02-18 17:05:54] === Monitor Check Started ===
[2026-02-18 17:05:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:05:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:05:54] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:05:54] === Monitor Check Complete ===
[2026-02-18 17:05:54]
[2026-02-18 17:06:29] === Monitor Check Started ===
[2026-02-18 17:06:29] gantt-board (port 3000) is UP ✓
[2026-02-18 17:06:29] blog-backup (port 3003) is UP ✓
[2026-02-18 17:06:29] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:06:29] === Monitor Check Complete ===
[2026-02-18 17:06:29]
[2026-02-18 17:07:07] Starting web app monitor check
[2026-02-18 17:07:27] Starting web app monitor check
[2026-02-18 17:07:27] gantt-board (port 3000) is UP
[2026-02-18 17:07:27] blog-backup (port 3003) is UP
[2026-02-18 17:07:27] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:07:27] Final verification:
[2026-02-18 17:07:27] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:07:27] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:07:27] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:07:27] All web apps are running
[2026-02-18 17:07:27] Monitor check complete
---
[2026-02-18 17:07:55] === Monitor Check Started ===
[2026-02-18 17:07:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:07:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:07:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:07:55] === Monitor Check Complete ===
[2026-02-18 17:07:55]
[2026-02-18 17:08:55] === Monitor Check Started ===
[2026-02-18 17:08:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:08:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:08:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:08:55] === Monitor Check Complete ===
[2026-02-18 17:08:55]
[2026-02-18 17:09:55] === Monitor Check Started ===
[2026-02-18 17:09:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:09:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:09:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:09:55] === Monitor Check Complete ===
[2026-02-18 17:09:55]
[2026-02-18 17:10:55] === Monitor Check Started ===
[2026-02-18 17:10:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:10:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:10:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:10:55] === Monitor Check Complete ===
[2026-02-18 17:10:55]
[2026-02-18 17:13:54] === Monitor Check Started ===
[2026-02-18 17:13:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:13:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:13:59] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:13:59] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:14:02] heartbeat-monitor restart command issued (PID: 25294)
[2026-02-18 17:14:02] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:14:07] === Verification Check ===
[2026-02-18 17:14:12] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:14:12] === Monitor Check Complete ===
[2026-02-18 17:14:12]
[2026-02-18 17:14:55] === Monitor Check Started ===
[2026-02-18 17:14:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:14:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:15:00] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:15:00] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:15:02] heartbeat-monitor restart command issued (PID: 25457)
[2026-02-18 17:15:02] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:15:07] === Verification Check ===
[2026-02-18 17:15:12] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:15:12] === Monitor Check Complete ===
[2026-02-18 17:15:12]
[2026-02-18 17:15:54] === Monitor Check Started ===
[2026-02-18 17:15:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:15:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:15:59] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:15:59] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:16:01] heartbeat-monitor restart command issued (PID: 25610)
[2026-02-18 17:16:01] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:16:06] === Verification Check ===
[2026-02-18 17:16:11] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:16:11] === Monitor Check Complete ===
[2026-02-18 17:16:11]
[2026-02-18 17:21:06] === Monitor Check Started ===
[2026-02-18 17:21:06] gantt-board (port 3000) is UP ✓
[2026-02-18 17:21:06] blog-backup (port 3003) is UP ✓
[2026-02-18 17:21:11] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:21:11] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:21:13] heartbeat-monitor restart command issued (PID: 26332)
[2026-02-18 17:21:13] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:21:18] === Verification Check ===
[2026-02-18 17:21:23] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:21:23] === Monitor Check Complete ===
[2026-02-18 17:21:23]
[2026-02-18 17:22:15] === Monitor Check Started ===
[2026-02-18 17:22:15] gantt-board (port 3000) is UP ✓
[2026-02-18 17:22:15] blog-backup (port 3003) is UP ✓
[2026-02-18 17:22:20] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:22:20] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:22:22] heartbeat-monitor restart command issued (PID: 26484)
[2026-02-18 17:22:22] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:22:27] === Verification Check ===
[2026-02-18 17:22:32] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:22:32] === Monitor Check Complete ===
[2026-02-18 17:22:32]
[2026-02-18 17:22:48] === Monitor Check Started ===
[2026-02-18 17:22:48] gantt-board (port 3000) is UP ✓
[2026-02-18 17:22:48] blog-backup (port 3003) is UP ✓
[2026-02-18 17:22:53] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:22:53] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:22:56] heartbeat-monitor restart command issued (PID: 26620)
[2026-02-18 17:22:56] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:23:01] === Monitor Check Started ===
[2026-02-18 17:23:01] gantt-board (port 3000) is UP ✓
[2026-02-18 17:23:01] blog-backup (port 3003) is UP ✓
[2026-02-18 17:23:06] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:23:06] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:23:08] heartbeat-monitor restart command issued (PID: 26713)
[2026-02-18 17:23:08] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:23:12] === Monitor Check Started ===
[2026-02-18 17:23:12] gantt-board (port 3000) is UP ✓
[2026-02-18 17:23:12] blog-backup (port 3003) is UP ✓
[2026-02-18 17:23:13] === Verification Check ===
[2026-02-18 17:23:17] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:23:17] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:23:18] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:23:18] === Monitor Check Complete ===
[2026-02-18 17:23:18]
[2026-02-18 17:23:19] heartbeat-monitor restart command issued (PID: 26797)
[2026-02-18 17:23:19] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:23:24] === Monitor Check Started ===
[2026-02-18 17:23:24] gantt-board (port 3000) is UP ✓
[2026-02-18 17:23:24] blog-backup (port 3003) is UP ✓
[2026-02-18 17:23:24] === Verification Check ===
[2026-02-18 17:23:29] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:23:29] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:23:29] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:23:29] === Monitor Check Complete ===
[2026-02-18 17:23:29]
[2026-02-18 17:23:31] heartbeat-monitor restart command issued (PID: 26879)
[2026-02-18 17:23:31] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:23:35] === Monitor Check Started ===
[2026-02-18 17:23:35] gantt-board (port 3000) is UP ✓
[2026-02-18 17:23:35] blog-backup (port 3003) is UP ✓
[2026-02-18 17:23:39] === Monitor Check Started ===
[2026-02-18 17:23:39] gantt-board (port 3000) is UP ✓
[2026-02-18 17:23:39] blog-backup (port 3003) is UP ✓
[2026-02-18 17:23:44] heartbeat-monitor (port 3005) is DOWN - initiating restart
[2026-02-18 17:23:44] Restarting heartbeat-monitor on port 3005...
[2026-02-18 17:23:46] heartbeat-monitor restart command issued (PID: 26983)
[2026-02-18 17:23:46] Waiting 5 seconds for restarts to complete...
[2026-02-18 17:23:51] === Verification Check ===
[2026-02-18 17:23:56] heartbeat-monitor (port 3005) is still DOWN ✗
[2026-02-18 17:23:56] === Monitor Check Complete ===
[2026-02-18 17:23:56]
[2026-02-18 17:29:54] === Monitor Check Started ===
[2026-02-18 17:29:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:29:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:29:54] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:29:54] === Monitor Check Complete ===
[2026-02-18 17:29:54]
[2026-02-18 17:30:54] === Monitor Check Started ===
[2026-02-18 17:30:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:30:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:30:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:30:55] === Monitor Check Complete ===
[2026-02-18 17:30:55]
[2026-02-18 17:32:55] === Monitor Check Started ===
[2026-02-18 17:32:56] gantt-board (port 3000) is UP ✓
[2026-02-18 17:32:56] blog-backup (port 3003) is UP ✓
[2026-02-18 17:32:56] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:32:56] === Monitor Check Complete ===
[2026-02-18 17:32:56]
[2026-02-18 17:33:54] === Monitor Check Started ===
[2026-02-18 17:33:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:33:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:33:54] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:33:54] === Monitor Check Complete ===
[2026-02-18 17:33:54]
[2026-02-18 17:34:55] === Monitor Check Started ===
[2026-02-18 17:34:55] gantt-board (port 3000) is UP ✓
[2026-02-18 17:34:55] blog-backup (port 3003) is UP ✓
[2026-02-18 17:34:55] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:34:55] === Monitor Check Complete ===
[2026-02-18 17:34:55]
[2026-02-18 17:35:54] === Monitor Check Started ===
[2026-02-18 17:35:54] gantt-board (port 3000) is UP ✓
[2026-02-18 17:35:54] blog-backup (port 3003) is UP ✓
[2026-02-18 17:35:54] heartbeat-monitor (port 3005) is UP ✓
[2026-02-18 17:35:54] === Monitor Check Complete ===
[2026-02-18 17:35:54]
[2026-02-18 17:37:12] Starting web app monitor check
[2026-02-18 17:37:12] gantt-board (port 3000) is UP
[2026-02-18 17:37:12] blog-backup (port 3003) is UP
[2026-02-18 17:37:12] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:37:12] Final verification:
[2026-02-18 17:37:12] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:37:12] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:37:12] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:37:12] All web apps are running
[2026-02-18 17:37:12] Monitor check complete
---
[2026-02-18 17:37:15] Starting web app monitor check
[2026-02-18 17:37:15] gantt-board (port 3000) is UP
[2026-02-18 17:37:15] blog-backup (port 3003) is UP
[2026-02-18 17:37:15] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:37:15] Final verification:
[2026-02-18 17:37:15] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:37:15] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:37:15] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:37:15] All web apps are running
[2026-02-18 17:37:15] Monitor check complete
---
[2026-02-18 17:37:35] Starting web app monitor check
[2026-02-18 17:37:35] gantt-board (port 3000) is UP
[2026-02-18 17:37:35] blog-backup (port 3003) is UP
[2026-02-18 17:37:35] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:37:35] Final verification:
[2026-02-18 17:37:36] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:37:36] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:37:36] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:37:36] All web apps are running
[2026-02-18 17:37:36] Monitor check complete
---
[2026-02-18 17:37:55] Starting web app monitor check
[2026-02-18 17:37:55] gantt-board (port 3000) is UP
[2026-02-18 17:37:55] blog-backup (port 3003) is UP
[2026-02-18 17:37:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:37:55] Final verification:
[2026-02-18 17:37:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:37:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:37:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:37:55] All web apps are running
[2026-02-18 17:37:55] Monitor check complete
---
[2026-02-18 17:38:54] Starting web app monitor check
[2026-02-18 17:38:54] gantt-board (port 3000) is UP
[2026-02-18 17:38:54] blog-backup (port 3003) is UP
[2026-02-18 17:38:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:38:55] Final verification:
[2026-02-18 17:38:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:38:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:38:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:38:55] All web apps are running
[2026-02-18 17:38:55] Monitor check complete
---
[2026-02-18 17:39:54] Starting web app monitor check
[2026-02-18 17:39:54] gantt-board (port 3000) is UP
[2026-02-18 17:39:54] blog-backup (port 3003) is UP
[2026-02-18 17:39:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:39:54] Final verification:
[2026-02-18 17:39:54] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:39:54] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:39:54] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:39:54] All web apps are running
[2026-02-18 17:39:54] Monitor check complete
---
[2026-02-18 17:40:55] Starting web app monitor check
[2026-02-18 17:40:55] gantt-board (port 3000) is UP
[2026-02-18 17:40:55] blog-backup (port 3003) is UP
[2026-02-18 17:40:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:40:55] Final verification:
[2026-02-18 17:40:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:40:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:40:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:40:55] All web apps are running
[2026-02-18 17:40:55] Monitor check complete
---
[2026-02-18 17:42:55] Starting web app monitor check
[2026-02-18 17:42:55] gantt-board (port 3000) is UP
[2026-02-18 17:42:55] blog-backup (port 3003) is UP
[2026-02-18 17:42:56] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:42:56] Final verification:
[2026-02-18 17:42:56] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:42:56] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:42:56] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:42:56] All web apps are running
[2026-02-18 17:42:56] Monitor check complete
---
[2026-02-18 17:43:54] Starting web app monitor check
[2026-02-18 17:43:54] gantt-board (port 3000) is UP
[2026-02-18 17:43:54] blog-backup (port 3003) is UP
[2026-02-18 17:43:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:43:54] Final verification:
[2026-02-18 17:43:54] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:43:54] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:43:54] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:43:54] All web apps are running
[2026-02-18 17:43:54] Monitor check complete
---
[2026-02-18 17:44:55] Starting web app monitor check
[2026-02-18 17:44:55] gantt-board (port 3000) is UP
[2026-02-18 17:44:55] blog-backup (port 3003) is UP
[2026-02-18 17:44:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:44:55] Final verification:
[2026-02-18 17:44:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:44:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:44:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:44:55] All web apps are running
[2026-02-18 17:44:55] Monitor check complete
---
[2026-02-18 17:45:55] Starting web app monitor check
[2026-02-18 17:45:55] gantt-board (port 3000) is UP
[2026-02-18 17:45:55] blog-backup (port 3003) is UP
[2026-02-18 17:45:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:45:55] Final verification:
[2026-02-18 17:45:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:45:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:45:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:45:55] All web apps are running
[2026-02-18 17:45:55] Monitor check complete
---
[2026-02-18 17:47:11] Starting web app monitor check
[2026-02-18 17:47:11] gantt-board (port 3000) is UP
[2026-02-18 17:47:11] blog-backup (port 3003) is UP
[2026-02-18 17:47:11] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:47:11] Final verification:
[2026-02-18 17:47:11] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:47:11] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:47:11] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:47:11] All web apps are running
[2026-02-18 17:47:11] Monitor check complete
---
[2026-02-18 17:47:30] Starting web app monitor check
[2026-02-18 17:47:30] gantt-board (port 3000) is UP
[2026-02-18 17:47:30] blog-backup (port 3003) is UP
[2026-02-18 17:47:30] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:47:30] Final verification:
[2026-02-18 17:47:30] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:47:30] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:47:30] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:47:30] All web apps are running
[2026-02-18 17:47:30] Monitor check complete
---
[2026-02-18 17:47:55] Starting web app monitor check
[2026-02-18 17:47:55] gantt-board (port 3000) is UP
[2026-02-18 17:47:55] blog-backup (port 3003) is UP
[2026-02-18 17:47:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:47:55] Final verification:
[2026-02-18 17:47:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:47:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:47:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:47:55] All web apps are running
[2026-02-18 17:47:55] Monitor check complete
---
[2026-02-18 17:48:54] Starting web app monitor check
[2026-02-18 17:48:54] gantt-board (port 3000) is UP
[2026-02-18 17:48:54] blog-backup (port 3003) is UP
[2026-02-18 17:48:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:48:54] Final verification:
[2026-02-18 17:48:54] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:48:54] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:48:54] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:48:54] All web apps are running
[2026-02-18 17:48:54] Monitor check complete
---
[2026-02-18 17:49:55] Starting web app monitor check
[2026-02-18 17:49:55] gantt-board (port 3000) is UP
[2026-02-18 17:49:55] blog-backup (port 3003) is UP
[2026-02-18 17:49:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:49:55] Final verification:
[2026-02-18 17:49:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:49:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:49:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:49:55] All web apps are running
[2026-02-18 17:49:55] Monitor check complete
---
[2026-02-18 17:50:54] Starting web app monitor check
[2026-02-18 17:50:54] gantt-board (port 3000) is UP
[2026-02-18 17:50:54] blog-backup (port 3003) is UP
[2026-02-18 17:50:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:50:54] Final verification:
[2026-02-18 17:50:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:50:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:50:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:50:55] All web apps are running
[2026-02-18 17:50:55] Monitor check complete
---
[2026-02-18 17:52:13] Starting web app monitor check
[2026-02-18 17:52:13] gantt-board (port 3000) is UP
[2026-02-18 17:52:13] blog-backup (port 3003) is UP
[2026-02-18 17:52:13] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:52:13] Final verification:
[2026-02-18 17:52:13] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:52:13] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:52:13] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:52:13] All web apps are running
[2026-02-18 17:52:13] Monitor check complete
---
[2026-02-18 17:52:34] Starting web app monitor check
[2026-02-18 17:52:34] gantt-board (port 3000) is UP
[2026-02-18 17:52:34] blog-backup (port 3003) is UP
[2026-02-18 17:52:34] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:52:34] Final verification:
[2026-02-18 17:52:34] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:52:34] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:52:34] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:52:34] All web apps are running
[2026-02-18 17:52:34] Monitor check complete
---
[2026-02-18 17:52:54] Starting web app monitor check
[2026-02-18 17:52:54] gantt-board (port 3000) is UP
[2026-02-18 17:52:54] blog-backup (port 3003) is UP
[2026-02-18 17:52:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:52:54] Final verification:
[2026-02-18 17:52:54] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:52:54] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:52:54] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:52:54] All web apps are running
[2026-02-18 17:52:54] Monitor check complete
---
[2026-02-18 17:53:54] Starting web app monitor check
[2026-02-18 17:53:54] gantt-board (port 3000) is UP
[2026-02-18 17:53:54] blog-backup (port 3003) is UP
[2026-02-18 17:53:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:53:54] Final verification:
[2026-02-18 17:53:54] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:53:54] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:53:54] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:53:54] All web apps are running
[2026-02-18 17:53:54] Monitor check complete
---
[2026-02-18 17:54:54] Starting web app monitor check
[2026-02-18 17:54:54] gantt-board (port 3000) is UP
[2026-02-18 17:54:54] blog-backup (port 3003) is UP
[2026-02-18 17:54:54] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:54:54] Final verification:
[2026-02-18 17:54:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:54:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:54:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:54:55] All web apps are running
[2026-02-18 17:54:55] Monitor check complete
---
[2026-02-18 17:55:55] Starting web app monitor check
[2026-02-18 17:55:55] gantt-board (port 3000) is UP
[2026-02-18 17:55:55] blog-backup (port 3003) is UP
[2026-02-18 17:55:55] heartbeat-monitor (port 3005) is UP
[2026-02-18 17:55:55] Final verification:
[2026-02-18 17:55:55] ✓ gantt-board (port 3000) - UP
[2026-02-18 17:55:55] ✓ blog-backup (port 3003) - UP
[2026-02-18 17:55:55] ✓ heartbeat-monitor (port 3005) - UP
[2026-02-18 17:55:55] All web apps are running
[2026-02-18 17:55:55] Monitor check complete
---

View File

@ -51,3 +51,72 @@ All 3 sites running stable after fix.
- Priority: Medium - Priority: Medium
- Board uses localStorage which requires hard refresh to see updates - Board uses localStorage which requires hard refresh to see updates
- Need server-side storage or sync mechanism for normal refresh updates - Need server-side storage or sync mechanism for normal refresh updates
## [4:36 PM] Web App Health Check - All Healthy
- **Port 3000** (gantt-board): HTTP 200 (56ms) ✅
- **Port 3003** (blog-backup): HTTP 200 (12ms) ✅
- **Port 3005** (heartbeat-monitor): HTTP 200 (5ms) ✅
No restarts required.
## [6:02 PM] Cron Restarted All 3 Apps
All 3 web apps went down and the cron job manually restarted them:
- gantt-board (3000): Restarted and healthy
- blog-backup (3003): Restarted and healthy
- heartbeat-monitor (3005): Restarted and healthy
**Issue**: Auto-restart in cron environment has PATH/npm availability problems.
## [6:20 PM] Heartbeat Monitor Redesign Complete
Successfully rebuilt Heartbeat Monitor dashboard with:
- Fixed 280px glassmorphism sidebar
- Full-width max-w-7xl main content
- 4 KPI cards (grid-cols-2 md:grid-cols-4)
- 3-column service grid (grid-cols-1 md:grid-cols-2 lg:grid-cols-3)
- shadcn-style Card, Badge, Progress components
- Framer Motion animations
- Sparkline charts using recharts
**Tested and working** at http://localhost:3005
## [6:33 PM] Switched to Codex Branch
User wanted to show the codex branch design for comparison:
- Checked out `codex` branch from Gitea
- Different design approach - centered layout, single column
- Restarted server successfully
## [7:20 PM] Screenshot Capability Solved
**Problem**: User needed screenshots of local websites to share with friends (cannot access from outside home network).
**Investigation Results**:
- screencapture: Exists but requires interactive mode
- Playwright + Chrome: ✅ WORKS - successfully tested
- OpenClaw browser tool: Requires Chrome extension (not connected)
**Solution**: Installed Playwright globally (`npm install -g playwright`)
**Delivered**: 3 screenshots sent to Telegram:
1. Project Hub (gantt-board)
2. Blog Backup
3. Heartbeat Monitor (codex branch)
## [8:42 PM] All Sites Down - Manual Restart Required
All 3 web apps were down when monitor ran at 8:42 PM. Cron auto-restart failed due to PATH/npm environment issues. Manually restarted all services:
- gantt-board (3000): ✅ HTTP 200
- blog-backup (3003): ✅ HTTP 200
- heartbeat-monitor (3005): ✅ HTTP 200
**Action Items**:
- Fix cron auto-restart environment (PATH, npm availability)
- Consider using full paths in restart script
## [8:45 PM] Evening Status
All 3 web apps running stable after manual restart.
Playwright screenshot capability now permanently available.
User out for the evening - continuing work on open tasks.

42
memory/web-monitor.log Normal file
View File

@ -0,0 +1,42 @@
[2026-02-18T17:53:00-06:00] Monitor Check - All Ports OK
Port 3000 (gantt-board): 200
Port 3003 (blog-backup): 200
Port 3005 (heartbeat-monitor): 200
Action: None needed
[2026-02-18 17:54:00 CST] Port 3000 (gantt-board): 200 OK
[2026-02-18 17:54:00 CST] Port 3003 (blog-backup): 200 OK
[2026-02-18 17:54:00 CST] Port 3005 (heartbeat-monitor): 200 OK
[2026-02-18 17:54:00 CST] All services healthy - no restart needed
---
[2026-02-18 17:55:00 CST] Web Monitor Check
=====================================
Port 3000 (gantt-board): 200 OK
Port 3003 (blog-backup): 200 OK
Port 3005 (heartbeat-monitor): 200 OK
Status: All services healthy
No restarts required.
[2026-02-18 17:57:38 CST] 🔔 Web monitor cron job initialized - checks every 5 min
[2026-02-18 18:02:15 CST] Web Monitor - Apps restarted by cron job
Port 3000 (gantt-board): 200 OK
Port 3003 (blog-backup): 200 OK
Port 3005 (heartbeat-monitor): 200 OK
Action: All 3 apps were restarted successfully
[2026-02-18 18:06:39 CST] ✅ All web apps healthy (3000, 3003, 3005)
[2026-02-18 18:31:39 CST] ⚠️ heartbeat-monitor (port 3005) is DOWN - restarting...
[2026-02-18 18:31:39 CST] 🔄 heartbeat-monitor restarted on port 3005
[2026-02-18 18:31:39 CST] ❌ heartbeat-monitor still unhealthy (HTTP 000DOWN)
[2026-02-18 18:31:50 CST] ⚠️ heartbeat-monitor (port 3005) is DOWN - restarting...
[2026-02-18 18:31:50 CST] 🔄 heartbeat-monitor restarted on port 3005
[2026-02-18 18:31:50 CST] ❌ heartbeat-monitor still unhealthy (HTTP 000DOWN)
[2026-02-18 18:32:27 CST] ⚠️ heartbeat-monitor (port 3005) is DOWN - restarting...
[2026-02-18 18:32:27 CST] 🔄 heartbeat-monitor restarted on port 3005
[2026-02-18 18:32:27 CST] ❌ heartbeat-monitor still unhealthy (HTTP 000DOWN)
[2026-02-18 18:41:39 CST] ✅ All web apps healthy (3000, 3003, 3005)
[2026-02-18 19:06:45 CST] ✅ All web apps healthy (3000, 3003, 3005)
[2026-02-18 19:36:43 CST] ✅ All web apps healthy (3000, 3003, 3005)
[2026-02-18 20:06:40 CST] ✅ All web apps healthy (3000, 3003, 3005)
[2026-02-18 20:31:39 CST] ✅ All web apps healthy (3000, 3003, 3005)
[2026-02-18 20:42:17 CST] ✅ Web Monitor - All 3 apps restarted and verified healthy

97
scripts/web-monitor.sh Executable file
View File

@ -0,0 +1,97 @@
#!/bin/zsh
# Web Apps Monitor - Auto-restart if down
# Ports: 3000 (gantt-board), 3003 (blog-backup), 3005 (heartbeat-monitor)
LOG_FILE="/Users/mattbruce/.openclaw/workspace/memory/web-monitor.log"
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S %Z')
# Ensure PATH for cron (include Homebrew on macOS)
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.local/bin:$PATH"
# Ensure log file exists
touch "$LOG_FILE"
# Function to check health
check_health() {
local port=$1
local name=$2
local code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "http://localhost:$port" 2>/dev/null || echo "DOWN")
echo "$code"
}
# Function to restart app
restart_app() {
local port=$1
local name=$2
local path=$3
echo "[$TIMESTAMP] ⚠️ $name (port $port) is DOWN - restarting..." >> "$LOG_FILE"
# Kill process on that port
pkill -f ":$port" 2>/dev/null
/bin/sleep 2
# Restart in background using full path to npm
cd "$path" && /opt/homebrew/bin/npm run dev -- --port "$port" > /dev/null 2>&1 &
echo "[$TIMESTAMP] 🔄 $name restarted on port $port" >> "$LOG_FILE"
}
# Check all apps
RESTARTED=()
# Port 3000 - gantt-board
code3000=$(check_health 3000 "gantt-board")
if [ "$code3000" != "200" ]; then
restart_app 3000 "gantt-board" "/Users/mattbruce/Documents/Projects/OpenClaw/Web/gantt-board"
RESTARTED+=("gantt-board")
fi
# Port 3003 - blog-backup
code3003=$(check_health 3003 "blog-backup")
if [ "$code3003" != "200" ]; then
restart_app 3003 "blog-backup" "/Users/mattbruce/Documents/Projects/OpenClaw/Web/blog-backup"
RESTARTED+=("blog-backup")
fi
# Port 3005 - heartbeat-monitor
code3005=$(check_health 3005 "heartbeat-monitor")
if [ "$code3005" != "200" ]; then
restart_app 3005 "heartbeat-monitor" "/Users/mattbruce/Documents/Projects/OpenClaw/Web/heartbeat-monitor"
RESTARTED+=("heartbeat-monitor")
fi
# If any were restarted, wait and re-verify
if [ ${#RESTARTED[@]} -gt 0 ]; then
/bin/sleep 5
for app in "${RESTARTED[@]}"; do
case $app in
"gantt-board") port=3000 ;;
"blog-backup") port=3003 ;;
"heartbeat-monitor") port=3005 ;;
esac
verify_code=$(check_health "$port" "$app")
if [ "$verify_code" = "200" ]; then
echo "[$TIMESTAMP] ✅ $app verified healthy (HTTP 200)" >> "$LOG_FILE"
else
echo "[$TIMESTAMP] ❌ $app still unhealthy (HTTP $verify_code)" >> "$LOG_FILE"
fi
done
else
# All healthy - log periodically (every 6 runs ~ 30 min with 5-min interval)
if [ ! -f /tmp/web-monitor-counter ]; then
echo "0" > /tmp/web-monitor-counter
fi
counter=$(cat /tmp/web-monitor-counter)
counter=$((counter + 1))
if [ $counter -ge 6 ]; then
echo "[$TIMESTAMP] ✅ All web apps healthy (3000, 3003, 3005)" >> "$LOG_FILE"
counter=0
fi
echo "$counter" > /tmp/web-monitor-counter
fi

View File

@ -1,97 +1,108 @@
#!/bin/bash #!/bin/bash
# Web App Monitor - Auto-restart script
# Ports: 3000 (gantt-board), 3003 (blog-backup), 3005 (heartbeat-monitor)
LOG_FILE="/Users/mattbruce/.openclaw/workspace/logs/webapp-monitor.log" LOG_FILE="/Users/mattbruce/.openclaw/workspace/logs/webapp-monitor.log"
mkdir -p "$(dirname "$LOG_FILE")" mkdir -p "$(dirname "$LOG_FILE")"
timestamp() { # Function to get app name for port
date '+%Y-%m-%d %H:%M:%S %Z' get_app_name() {
case $1 in
3000) echo "gantt-board" ;;
3003) echo "blog-backup" ;;
3005) echo "heartbeat-monitor" ;;
*) echo "unknown" ;;
esac
} }
log() { # Function to get app directory for port
echo "[$(timestamp)] $1" | tee -a "$LOG_FILE" get_app_dir() {
case $1 in
3000) echo "/Users/mattbruce/Documents/Projects/OpenClaw/Web/gantt-board" ;;
3003) echo "/Users/mattbruce/Documents/Projects/OpenClaw/Web/blog-backup" ;;
3005) echo "/Users/mattbruce/Documents/Projects/OpenClaw/Web/heartbeat-monitor" ;;
*) echo "" ;;
esac
} }
# Function to check if port is responding with HTTP 200
check_port() { check_port() {
local port=$1 local port=$1
local timeout=5 local response
response=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "http://localhost:$port" 2>/dev/null)
if curl -s -o /dev/null -w "%{http_code}" --max-time "$timeout" "http://localhost:$port" | grep -q "200"; then if [ "$response" = "200" ]; then
echo "up" echo "up"
else else
echo "down" echo "down"
fi fi
} }
# Function to kill process on port
kill_port() { kill_port() {
local port=$1 local port=$1
log "Killing process on port $port..." pkill -f "--port $port" 2>/dev/null
pkill -f ":$port" 2>/dev/null || true pkill -f ":$port" 2>/dev/null
sleep 2
} }
# Function to restart app
restart_app() { restart_app() {
local port=$1 local port=$1
local dir=$2 local dir=$2
local name=$3 cd "$dir" && nohup npm run dev -- --port $port > /dev/null 2>&1 &
log "Restarting $name on port $port..."
cd "$dir" && npm run dev -- --port "$port" > /dev/null 2>&1 &
} }
# Define apps echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting web app monitor check" >> "$LOG_FILE"
APPS=(
"3000:/Users/mattbruce/Documents/Projects/OpenClaw/Web/gantt-board:gantt-board"
"3003:/Users/mattbruce/Documents/Projects/OpenClaw/Web/blog-backup:blog-backup"
"3005:/Users/mattbruce/Documents/Projects/OpenClaw/Web/heartbeat-monitor:heartbeat-monitor"
)
log "=== Starting web app monitor check ===" restarted_any=false
NEEDS_RESTART=()
# Check each app # Check each app
for app in "${APPS[@]}"; do for port in 3000 3003 3005; do
IFS=':' read -r port dir name <<< "$app" status=$(check_port $port)
app_name=$(get_app_name $port)
status=$(check_port "$port") if [ "$status" = "down" ]; then
if [ "$status" = "up" ]; then echo "[$(date '+%Y-%m-%d %H:%M:%S')] $app_name (port $port) is DOWN - restarting..." >> "$LOG_FILE"
log "$name (port $port) is UP" kill_port $port
restarted_any=true
else else
log "$name (port $port) is DOWN - will restart" echo "[$(date '+%Y-%m-%d %H:%M:%S')] $app_name (port $port) is UP" >> "$LOG_FILE"
NEEDS_RESTART+=("$app")
fi fi
done done
# Restart any down apps # Wait 2 seconds after kills, then restart down apps
if [ ${#NEEDS_RESTART[@]} -gt 0 ]; then if [ "$restarted_any" = true ]; then
log "--- Restarting ${#NEEDS_RESTART[@]} app(s) ---" sleep 2
for port in 3000 3003 3005; do
for app in "${NEEDS_RESTART[@]}"; do status=$(check_port $port)
IFS=':' read -r port dir name <<< "$app" if [ "$status" = "down" ]; then
kill_port "$port" app_name=$(get_app_name $port)
restart_app "$port" "$dir" "$name" app_dir=$(get_app_dir $port)
sleep 1 echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting $app_name on port $port..." >> "$LOG_FILE"
restart_app $port "$app_dir"
fi
done done
log "Waiting 5 seconds for apps to start..." # Wait 5 seconds for apps to start
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Waiting 5 seconds for apps to start..." >> "$LOG_FILE"
sleep 5 sleep 5
fi
# Verify restarts # Final verification
log "--- Verification ---" echo "[$(date '+%Y-%m-%d %H:%M:%S')] Final verification:" >> "$LOG_FILE"
for app in "${NEEDS_RESTART[@]}"; do all_up=true
IFS=':' read -r port dir name <<< "$app" for port in 3000 3003 3005; do
status=$(check_port "$port") status=$(check_port $port)
app_name=$(get_app_name $port)
if [ "$status" = "up" ]; then if [ "$status" = "up" ]; then
log "$name (port $port) is now UP" echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✓ $app_name (port $port) - UP" >> "$LOG_FILE"
else else
log "$name (port $port) still DOWN after restart" echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✗ $app_name (port $port) - STILL DOWN" >> "$LOG_FILE"
all_up=false
fi fi
done done
if [ "$all_up" = true ]; then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] All web apps are running" >> "$LOG_FILE"
else else
log "All apps healthy, no action needed" echo "[$(date '+%Y-%m-%d %H:%M:%S')] WARNING: Some web apps failed to start" >> "$LOG_FILE"
fi fi
log "=== Monitor check complete ===" echo "[$(date '+%Y-%m-%d %H:%M:%S')] Monitor check complete" >> "$LOG_FILE"
echo "---" >> "$LOG_FILE"

BIN
test-heartbeat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB