#!/bin/bash # Agent Health Monitor Startup Script # Starts the agent health monitoring service cd /root/.openclaw/workspace # Make sure the monitor script is executable chmod +x agent-monitor.js # Start the monitor in background nohup node agent-monitor.js > /root/.openclaw/workspace/logs/agents/monitor.log 2>&1 & echo "Agent health monitor started with PID: $!" # Create systemd service for auto-start on boot (optional) cat > /etc/systemd/system/openclaw-agent-monitor.service << EOF [Unit] Description=OpenClaw Agent Health Monitor After=network.target [Service] Type=simple User=root WorkingDirectory=/root/.openclaw/workspace ExecStart=/usr/bin/node /root/.openclaw/workspace/agent-monitor.js Restart=always RestartSec=10 [Install] WantedBy=multi-user.target EOF # Enable and start the service (uncomment if needed) # systemctl daemon-reload # systemctl enable openclaw-agent-monitor # systemctl start openclaw-agent-monitor