← 返回 Skills 市场
lgy2020

Openclaw Keepalive

作者 lgy2020 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
216
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install keepalive
功能描述
Keep OpenClaw gateway running 24/7 on a laptop or workstation. Use when: (1) user reports gateway disconnects or crashes, (2) user asks how to make OpenClaw...
使用说明 (SKILL.md)

OpenClaw Gateway Keepalive

Ensure the OpenClaw gateway process stays running across reboots, crashes, sleep, and network interruptions.

Quick Start (Recommended)

Register as a system service with one command (all platforms):

openclaw gateway install

Effects:

  • ✅ Auto-start on boot — no terminal needed
  • ✅ Runs in background — survives terminal close
  • ✅ Survives screen lock — independent of user session
  • ✅ Auto-restart on crash — OS-level process supervision

Verify:

openclaw gateway status

Expected output:

  • Service: Scheduled Task (registered)
  • RPC probe: ok
  • Port: [127.0.0.1:18789]

Commands

Command Description
openclaw gateway install Register as system service (one-time)
openclaw gateway uninstall Remove system service
openclaw gateway start Start gateway manually
openclaw gateway stop Stop gateway
openclaw gateway restart Restart gateway
openclaw gateway status Check gateway status
openclaw logs --follow Tail real-time logs

Platform Differences

Windows

  • Registers via Task Scheduler (schtasks)
  • Service name: OpenClaw Gateway
  • Survives screen lock and user session disconnect

macOS

  • Registers via launchd plist
  • Supports KeepAlive=true for auto-restart

Linux

  • Registers via systemd service
  • Supports Restart=on-failure policy

Prevent Sleep (Critical)

The gateway requires the computer to stay awake. Configure power settings:

Windows

# List current power plans
powercfg /list

# Never sleep when plugged in
powercfg /change standby-timeout-ac 0

# Allow display off but keep system awake
powercfg /change monitor-timeout-ac 10

macOS

# Prevent system sleep
sudo pmset -a sleep 0

# Prevent disk sleep
sudo pmset -a disksleep 0

# Allow display off but keep system running
sudo pmset -a displaysleep 10

Linux

# Disable suspend
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Network Recovery

The gateway's WebSocket connection auto-reconnects after network interruptions using exponential backoff (1s → 2s → 4s → ...).

Manual restart if needed:

openclaw gateway restart

Troubleshooting

Gateway Unresponsive

openclaw gateway status    # Check process status
openclaw logs --follow     # View real-time logs
openclaw gateway restart   # Attempt restart

Service Not Registered

openclaw gateway install   # Re-register
openclaw gateway status    # Verify

Frequent Crashes

  1. Check logs with openclaw logs --follow for crash cause
  2. Ensure sufficient memory (Node.js process needs at least 512MB free)
  3. Check for port conflicts (default: 18789)
  4. Update to latest version

Advanced: External Process Supervisors

If gateway install is not stable enough, use external tools:

Option A: pm2 (Recommended, Cross-Platform)

npm install -g pm2
pm2 start openclaw -- gateway start
pm2 save
pm2 startup  # Generate startup command

Option B: NSSM (Windows Only)

nssm install OpenClaw "C:\Program Files\
odejs\
ode.exe" "openclaw gateway start"
nssm set OpenClaw AppExit Default Restart
nssm start OpenClaw

Option C: Windows Task Scheduler (Manual)

# Create auto-start task with 1-minute restart on failure
schtasks /create /tn "OpenClaw Gateway" /tr "openclaw gateway start" /sc onstart /rl highest /f

# Or use Task Scheduler GUI for finer restart policies

Healthcheck Scripts

Schedule these with cron or Task Scheduler for periodic health checks with auto-restart.

Windows (healthcheck.cmd)

@echo off
REM OpenClaw Gateway Healthcheck Script (Windows)
REM Run periodically via Task Scheduler or cron
REM Exit code 0 = healthy, 1 = failed to recover

echo [%date% %time%] Checking OpenClaw Gateway status...

openclaw gateway status >nul 2>&1
if %errorlevel% neq 0 (
    echo [%date% %time%] Gateway not responding. Attempting restart...
    openclaw gateway restart >nul 2>&1
    timeout /t 5 >nul
    openclaw gateway status >nul 2>&1
    if %errorlevel% neq 0 (
        echo [%date% %time%] CRITICAL: Gateway failed to restart!
        exit /b 1
    ) else (
        echo [%date% %time%] Gateway restarted successfully.
        exit /b 0
    )
) else (
    echo [%date% %time%] Gateway is running normally.
    exit /b 0
)

Linux/macOS (healthcheck.sh)

#!/bin/bash
# OpenClaw Gateway Healthcheck Script (Linux/macOS)
# Usage: bash healthcheck.sh - can be scheduled via cron
# Example cron: */5 * * * * /path/to/healthcheck.sh >> /var/log/openclaw-healthcheck.log 2>&1

TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')

echo "[$TIMESTAMP] Checking OpenClaw Gateway status..."

if openclaw gateway status > /dev/null 2>&1; then
    echo "[$TIMESTAMP] Gateway is running normally."
    exit 0
else
    echo "[$TIMESTAMP] Gateway not responding. Attempting restart..."
    openclaw gateway restart > /dev/null 2>&1
    sleep 5
    
    if openclaw gateway status > /dev/null 2>&1; then
        echo "[$TIMESTAMP] Gateway restarted successfully."
        exit 0
    else
        echo "[$TIMESTAMP] CRITICAL: Gateway failed to restart!"
        exit 1
    fi
fi

Save to a location of your choice and schedule:

  • Windows: Task Scheduler → Run every 5 minutes
  • Linux/macOS: */5 * * * * /path/to/healthcheck.sh >> /var/log/openclaw-healthcheck.log 2>&1
安全使用建议
This skill's instructions are coherent for keeping a local gateway running, but there are two red flags: (1) the README assumes and runs an 'openclaw' CLI and several admin-level OS commands while the registry metadata lists no required binaries or source, and (2) there's no homepage or repository to inspect what 'openclaw gateway install' actually does. Before running anything: (a) obtain the openclaw binary from an official, verifiable source (homepage or repo) and inspect its install script or run it in a sandbox/VM, (b) avoid running opaque install commands with sudo until you can review them, (c) prefer non-global installs (avoid npm -g) or pin package versions and review packages, (d) back up system settings before changing power/sleep configuration, and (e) consider using an isolated machine or container if you must test these instructions. If the publisher can provide a source repository, release checksums, or documentation showing exactly what 'openclaw gateway install' does, that information would raise confidence and could change the assessment to benign.
功能分析
Type: OpenClaw Skill Name: keepalive Version: 1.0.0 The skill provides legitimate instructions and scripts to ensure the OpenClaw gateway remains running persistently across reboots and crashes. It utilizes standard system tools such as systemd, launchd, and Windows Task Scheduler, along with power management commands (e.g., powercfg, pmset) to prevent system sleep. All actions are transparently documented and directly aligned with the stated purpose of maintaining gateway uptime.
能力评估
Purpose & Capability
The SKILL.md describes exactly the actions you'd expect to keep a gateway alive (registering services, power settings, healthchecks). However the registry metadata declares no required binaries or credentials while the instructions clearly require an 'openclaw' CLI and administrative tools (sudo, systemctl, schtasks/powershell, pmset, powercfg, npm, nssm). This mismatch (declared requirements: none vs actual commands: many) is a material incoherence.
Instruction Scope
Instructions stay on-topic (service registration, auto-restart, healthchecks, preventing sleep). They do, however, recommend system-wide and potentially disruptive changes (masking suspend targets, globally disabling sleep, altering power plans) and run privileged commands. The doc also instructs installing packages from npm (pm2) and using `openclaw gateway install` — the latter is opaque and could execute arbitrary privileged operations; the skill does not provide verification steps or show what that install command does.
Install Mechanism
There is no install spec (instruction-only), which is lower risk from the registry side. But the instructions ask users to run npm install -g pm2 (pulls remote code) and to run an unverified 'openclaw' CLI install command. Because there is no homepage, source repo, or checksums, the guidance to install or run global packages raises trust questions even though the mechanism itself is common.
Credentials
The skill does not request credentials or environment variables and the actions described do not require service tokens. No disproportionate secret or unrelated credential access is declared or implied.
Persistence & Privilege
The skill advises creating system services and changing OS-level power settings which require elevated privileges — appropriate for the task but high‑impact. Because the skill lacks provenance and the primary action (`openclaw gateway install`) is not auditable here, granting those privileges before verification could be risky.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install keepalive
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /keepalive 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of openclaw-keepalive. - Enables OpenClaw gateway to run persistently on Windows, Linux, and macOS. - Provides simple commands for install, status, start/stop, uninstall, and restart as a system service. - Auto-starts on system boot and restarts automatically on crashes. - Detailed power configuration instructions to keep computers awake and processes alive. - Includes troubleshooting guidance and advanced supervision options (pm2, NSSM, scripts). - Built-in WebSocket auto-reconnect and platform-specific service integration.
元数据
Slug keepalive
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Openclaw Keepalive 是什么?

Keep OpenClaw gateway running 24/7 on a laptop or workstation. Use when: (1) user reports gateway disconnects or crashes, (2) user asks how to make OpenClaw... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 216 次。

如何安装 Openclaw Keepalive?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install keepalive」即可一键安装,无需额外配置。

Openclaw Keepalive 是免费的吗?

是的,Openclaw Keepalive 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Openclaw Keepalive 支持哪些平台?

Openclaw Keepalive 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Openclaw Keepalive?

由 lgy2020(@lgy2020)开发并维护,当前版本 v1.0.0。

💬 留言讨论