AI Newsletter Digest improvements: fixed QP soft line break decoding, URL extraction, and content cleaning
This commit is contained in:
25
scripts/gateway-state-check.sh
Normal file
25
scripts/gateway-state-check.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# Gateway State Checker - runs periodically to detect if gateway is down
|
||||
|
||||
STATE_FILE="/home/openclaw/.openclaw/gateway-status.state"
|
||||
LOG_FILE="/home/openclaw/.openclaw/logs/gateway-state.log"
|
||||
|
||||
# Check if gateway is running
|
||||
if systemctl --user is-active --quiet openclaw-gateway.service; then
|
||||
# Gateway is up
|
||||
if [ -f "$STATE_FILE" ]; then
|
||||
if [ "$(cat "$STATE_FILE")" != "up" ]; then
|
||||
# State changed from down to up, but we'll handle that in the start script
|
||||
:
|
||||
fi
|
||||
fi
|
||||
# Ensure state is up
|
||||
echo "up" > "$STATE_FILE"
|
||||
else
|
||||
# Gateway is down
|
||||
if [ ! -f "$STATE_FILE" ] || [ "$(cat "$STATE_FILE")" != "down" ]; then
|
||||
# First time detecting it's down - update state
|
||||
echo "down" > "$STATE_FILE"
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Gateway is down (state changed to down)" >> "$LOG_FILE"
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user