# HEARTBEAT.md

## 🌊 Watchdog: noisemap Flask (port 5555)

Check if Flask is running on port 5555. If not — start it silently.

```shell
curl -s --connect-timeout 2 http://localhost:5555/ > /dev/null 2>&1 || (cd /home/node/.openclaw/workspace/tasks/flightradar24/prototype && nohup /home/node/.openclaw/workspace/tasks/flightradar24/prototype/venv/bin/python app.py > /tmp/noisemap.log 2>&1 &)
```

Run the shell command above. If Flask responded (exit 0) — do nothing.
If Flask was not running (exit non-0) — start it with the command above and report: "🚀 noisemap Flask restarted on port 5555".

## 🏔️ Watchdog: snowbike-rag (port 5557)

Check if snowbike-rag is running on port 5557. If not — start it via start.sh.

```shell
curl -s --connect-timeout 2 http://localhost:5557/health > /dev/null 2>&1 || bash /home/node/.openclaw/workspace/tasks/snowbike-rag/start.sh > /dev/null 2>&1
```

If Flask responded (exit 0) — do nothing, reply HEARTBEAT_OK.
If not running — start it and report: "🚀 snowbike-rag restarted on port 5557".

## 🌐 Watchdog: vpn-srv FRP tunnel

Check if vpn-srv FRP tunnel is active (port 3322 on relay).

```shell
timeout 3 bash -c 'echo > /dev/tcp/185.130.212.192/3322' 2>/dev/null && echo ok || echo FAIL
```

If FAIL — try to reconnect via SSH tunnel:
```shell
ssh -i /home/node/.openclaw/ha_ssh_key -o StrictHostKeyChecking=no -o Port=3322 vpn@185.130.212.192 'echo meNt85doC | sudo -S systemctl restart frpc' 2>/dev/null
```

If tunnel still down — alert: "⚠️ vpn-srv FRP tunnel down, manual intervention needed".


