Idle-shutdown

v1.0.0

Monitors user session idleness and automatically stops the OpenClaw Gateway after a configurable idle period to save resources and costs.

0· 34·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for yu200512/idle-shutdown.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Idle-shutdown" (yu200512/idle-shutdown) from ClawHub.
Skill page: https://clawhub.ai/yu200512/idle-shutdown
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install idle-shutdown

ClawHub CLI

Package manager switcher

npx clawhub@latest install idle-shutdown
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description match the actual behavior: a bash watcher that checks mtime of session transcripts under ~/.openclaw/agents/main/sessions and runs 'openclaw gateway stop' when idle. It does not request unrelated credentials or binaries.
Instruction Scope
SKILL.md instructs copying the provided script and creating a user systemd service; the runtime instructions only access the session directory, the openclaw binary, and write logs to the user's home. There are no instructions to read unrelated files, transmit data externally, or elevate privileges.
Install Mechanism
No installer or remote downloads are used — this is an instruction-only skill plus a local bash script. The install steps are limited to copying the script and creating a user systemd unit (no external code fetch).
Credentials
The skill requests no credentials and only uses standard environment variables (HOME, optional OPENCLAW_BIN, and user-configurable IDLE/POLL/paths). Writing logs to ~/.openclaw is expected for this purpose and is proportional.
Persistence & Privilege
The skill persists by creating a systemd --user service (normal for a watcher). 'always' is false and the service runs as the local user, not system-wide. This means it will stop the gateway autonomously when conditions are met — confirm you want an automated shutdown behavior.
Assessment
This skill appears to do exactly what it says: a lightweight, user-level watcher that stops the OpenClaw Gateway when session files are idle. Before installing: (1) inspect the script (it's small and readable) and confirm the SESSIONS_DIR and OPENCLAW_BIN values match your setup; (2) be aware it will stop your gateway automatically — test with a long IDLE_SECONDS in a non-production environment first; (3) systemd user services and 'stat -c' behavior are Linux-specific — if you run macOS or a different init system, the unit/script may not work as-is; (4) consider setting conservative defaults (larger IDLE_SECONDS) and monitoring the log at ~/.openclaw/logs/idle-shutdown.log after enabling. If you don't want automated shutdowns, do not enable the systemd service.

Like a lobster shell, security has layers — review code before you run it.

latestvk97an7b8x1kjdr79h3pqsym0qs85na3d
34downloads
0stars
1versions
Updated 11h ago
v1.0.0
MIT-0

Gateway Idle Shutdown

Monitors session activity between users and the bot, and automatically stops the OpenClaw Gateway when all sessions have been idle continuously beyond the configured threshold.

How It Works

  • Polls session transcript files (~/.openclaw/agents/main/sessions/) every 10 seconds for their last modification time (mtime)
  • Preferentially matches QQBot/channel/direct related session files
  • When the latest mtime is older than the threshold (default 120 seconds), executes openclaw gateway stop
  • Logs are written to ~/.openclaw/logs/idle-shutdown.log

Benefits

  • Resource Savings — Automatically stops 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 environments, shutting down idle services reduces compute costs by avoiding charges for unused uptime.
  • Energy Efficiency — Reduces power consumption by ensuring services only run when actually needed, lowering your carbon footprint.
  • Zero Manual Intervention — Once configured, the watcher runs autonomously with systemd; you never need to remember to shut down the Gateway manually.
  • Seamless Lifecycle Integration — The systemd watcher is bound to the Gateway service (BindsTo + PartOf), so it starts and stops in lockstep — no orphaned watcher processes and no stale state.
  • Configurable & Forgiving — Idle threshold, polling interval, session directory, and binary path are all controlled via environment variables; the watcher retries on failure instead of exiting abruptly.
  • Lightweight Footprint — A simple bash script with sleep-based polling uses negligible system resources, making it suitable for low-power devices and headless servers alike.

Installation

# 1. Copy the script
cp scripts/idle-shutdown.sh ~/.openclaw/workspace/scripts/
chmod +x ~/.openclaw/workspace/scripts/idle-shutdown.sh

# 2. Create the systemd service file
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/openclaw-idle-watch.service << 'EOF'
[Unit]
Description=OpenClaw idle gateway shutdown watcher
After=openclaw-gateway.service
BindsTo=openclaw-gateway.service
PartOf=openclaw-gateway.service

[Service]
Type=simple
ExecStart=%h/.openclaw/workspace/scripts/idle-shutdown.sh
Restart=on-failure
RestartSec=10s
Environment=HOME=%h
# Adjust this PATH if your openclaw binary lives elsewhere
Environment=PATH=%h/.local/bin:%h/bin:/usr/local/bin:/usr/bin:/bin
Environment=OPENCLAW_BIN=openclaw

[Install]
WantedBy=default.target
EOF

# 3. Enable and start the service
systemctl --user daemon-reload
systemctl --user enable openclaw-idle-watch.service
systemctl --user start openclaw-idle-watch.service

Configuration

Customize behavior via environment variables:

VariableDefaultDescription
IDLE_SECONDS120Idle threshold (seconds)
POLL_SECONDS10Polling interval (seconds)
SESSIONS_DIR~/.openclaw/agents/main/sessionsSession directory
LOG_FILE~/.openclaw/logs/idle-shutdown.logLog file path
OPENCLAW_BINopenclawopenclaw binary path

Uninstallation

systemctl --user stop openclaw-idle-watch.service
systemctl --user disable openclaw-idle-watch.service
rm ~/.config/systemd/user/openclaw-idle-watch.service
rm ~/.openclaw/workspace/scripts/idle-shutdown.sh

Service Lifecycle

  • The watcher is bound to openclaw-gateway.service (BindsTo + PartOf)
  • Gateway starts → Watcher starts automatically
  • Gateway stops → Watcher stops automatically
  • Watcher triggers on idle → Gateway is stopped → Watcher stops along with Gateway

Comments

Loading comments...