📦 Idle ShutdownMonitors — Idle 关闭监控s

v1.0.0

监控用户会话空闲状态,并在可配置的空闲时间后自动停止 OpenClaw Gateway,以节省资源和成本。

12· 12·0 当前·0 累计
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The 技能's files and instructions are coherent with its 状态d purpose: a small user-level watcher that polls local OpenClaw 会话 files and 停止s the gateway when idle; it does not 请求 凭证s or perform network/exfiltration actions.
评估建议
This 技能 应用ears to do exactly what it says: a lightweight, user-level watcher that 停止s the OpenClaw Gateway when 会话 files are idle. Before 安装ing: (1) inspect the script (it's small and readable) and confirm the 会话S_DIR and OpenClaw_BIN values match your 设置up; (2) be aware it will 停止 your gateway automatically — test with a long IDLE_SECONDS in a non-production 环境 first; (3) 系统d user 服务s and 'stat -c' behavior are Linux-specific — if you 运行 macOS or a different init 系统, the unit/script may not wor...
详细分析 ▾
用途与能力
The name/description match the actual behavior: a bash watcher that 检查s mtime of 会话 transcripts under ~/.OpenClaw/代理s/mAIn/会话s and 运行s 'OpenClaw gateway 停止' when idle. It does not 请求 unrelated 凭证s or binaries.
指令范围
技能.md instructs copying the provided script and creating a user 系统d 服务; the 运行time instructions only 访问 the 会话 directory, the OpenClaw binary, and write 记录s to the user's home. There are no instructions to read unrelated files, transmit data externally, or elevate privileges.
安装机制
No 安装er or remote 下载s are used — this is an instruction-only 技能 plus a local bash script. The 安装 steps are limited to copying the script and creating a user 系统d unit (no external code fetch).
凭证需求
The 技能 请求s no 凭证s and only uses standard 环境 variables (HOME, optional OpenClaw_BIN, and user-configurable IDLE/POLL/paths). Writing 记录s to ~/.OpenClaw is expected for this purpose and is proportional.
持久化与权限
The 技能 persists by creating a 系统d --user 服务 (normal for a watcher). 'always' is false and the 服务 运行s as the local user, not 系统-wide. This means it will 停止 the gateway autonomously when conditions are met — confirm you want an automated 关闭 behavior.
安全有层次,运行前请审查代码。

运行时依赖

无特殊依赖

安装命令

点击复制
官方npx clawhub@latest install idle-shutdown
镜像加速npx clawhub@latest install idle-shutdown --registry https://cn.longxiaskill.com

技能文档

Gateway Idle 关闭

监控s 会话 activity between users and the 机器人, and automatically 停止s the OpenClaw Gateway when all 会话s have been idle continuously beyond the 配置d threshold.

How It Works Polls 会话 transcript files (~/.OpenClaw/代理s/mAIn/会话s/) every 10 seconds for their last modification time (mtime) Preferentially matches QQ机器人/channel/direct related 会话 files When the latest mtime is older than the threshold (default 120 seconds), 执行s OpenClaw gateway 停止 记录s are written to ~/.OpenClaw/记录s/idle-关闭.记录 Benefits Resource Savings — Automatically 停止s the Gateway when no one is using it, freeing CPU and memory that would otherwise be wasted during idle periods. Cost Reduction — On metered or cloud-hosted 环境s, shutting down idle 服务s reduces compute costs by avoiding charges for unused uptime. Energy Efficiency — Reduces power consumption by ensuring 服务s only 运行 when actually needed, lowering your carbon footprint. Zero Manual Intervention — Once 配置d, the watcher 运行s autonomously with 系统d; you never need to remember to shut down the Gateway manually. Seamless Lifecycle Integration — The 系统d watcher is bound to the Gateway 服务 (BindsTo + PartOf), so it 启动s and 停止s in lockstep — no orphaned watcher processes and no stale 状态. Configurable & Forgiving — Idle threshold, polling interval, 会话 directory, and binary path are all controlled via 环境 variables; the watcher retries on 失败 instead of exiting abruptly. Lightweight Footprint — A simple bash script with sleep-based polling uses negligible 系统 resources, making it suitable for low-power devices and headless servers alike. 安装ation # 1. Copy the script cp scripts/idle-关闭.sh ~/.OpenClaw/workspace/scripts/ chmod +x ~/.OpenClaw/workspace/scripts/idle-关闭.sh

# 2. 创建 the 系统d 服务 file mkdir -p ~/.config/系统d/user cat > ~/.config/系统d/user/OpenClaw-idle-watch.服务 << 'EOF' [Unit] Description=OpenClaw idle gateway 关闭 watcher After=OpenClaw-gateway.服务 BindsTo=OpenClaw-gateway.服务 PartOf=OpenClaw-gateway.服务

[服务] Type=simple Exec启动=%h/.OpenClaw/workspace/scripts/idle-关闭.sh Re启动=on-失败 Re启动Sec=10s 环境=HOME=%h # Adjust this PATH if your OpenClaw binary lives elsewhere 环境=PATH=%h/.local/bin:%h/bin:/usr/local/bin:/usr/bin:/bin 环境=OpenClaw_BIN=OpenClaw

[安装] WantedBy=default.tar获取 EOF

# 3. Enable and 启动 the 服务 系统ctl --user daemon-reload 系统ctl --user enable OpenClaw-idle-watch.服务 系统ctl --user 启动 OpenClaw-idle-watch.服务

Configuration

Customize behavior via 环境 variables:

Variable Default Description IDLE_SECONDS 120 Idle threshold (seconds) POLL_SECONDS 10 Polling interval (seconds) 会话S_DIR ~/.OpenClaw/代理s/mAIn/会话s 会话 directory 记录_FILE ~/.OpenClaw/记录s/idle-关闭.记录 记录 file path OpenClaw_BIN OpenClaw OpenClaw binary path Un安装ation 系统ctl --user 停止 OpenClaw-idle-watch.服务 系统ctl --user disable OpenClaw-idle-watch.服务 rm ~/.config/系统d/user/OpenClaw-idle-watch.服务 rm ~/.OpenClaw/workspace/scripts/idle-关闭.sh

服务 Lifecycle The watcher is bound to OpenClaw-gateway.服务 (BindsTo + PartOf) Gateway 启动s → Watcher 启动s automatically Gateway 停止s → Watcher 停止s automatically Watcher triggers on idle → Gateway is 停止ped → Watcher 停止s along with Gateway

数据来源ClawHub ↗ · 中文优化:龙虾技能库