← 返回 Skills 市场
hanl754

Gateway Delayed Restart

作者 hanl754 · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
273
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gateway-delayed-restart
功能描述
延迟指定分钟数重启 OpenClaw Gateway,支持自定义延迟并通过飞书主动通知完成情况。
使用说明 (SKILL.md)

Gateway Delayed Restart - 延迟重启网关技能

📋 技能概述

在指定延迟后重启 OpenClaw Gateway,完成后主动通知。

核心能力:

  • ⏰ 延迟执行重启
  • 📝 支持自定义延迟时间
  • 🔧 自动执行重启命令
  • 📱 完成后主动通知(飞书消息)

🚀 快速开始

基础用法

# 2 分钟后重启
openclaw message send --channel feishu --target ou_xxxxx --message "/restart-gateway 2"

# 或直接执行
./skills/gateway-delayed-restart/restart.sh 2

Python 调用

import subprocess
import time

def restart_gateway(delay_minutes=2):
    """延迟重启网关"""
    delay_seconds = delay_minutes * 60
    time.sleep(delay_seconds)
    subprocess.run(['openclaw', 'gateway', 'restart'])
    print(f"✅ Gateway 已重启(延迟 {delay_minutes} 分钟)")

📚 完整参数

参数 默认值 说明
delay_minutes 2 延迟分钟数
notify true 是否发送通知
channel feishu 通知渠道
target - 通知目标 ID

🎯 使用场景

场景 1: 浏览器故障后重启

# 浏览器超时,2 分钟后重启
./restart.sh 2

场景 2: 定时维护

# 10 分钟后重启进行维护
./restart.sh 10

场景 3: 等待任务完成后重启

# 等待任务完成
wait_for_task()
# 然后重启
restart_gateway(0)  # 立即重启

🔧 脚本实现

Bash 版本

#!/bin/bash
# restart.sh - 延迟重启网关脚本

DELAY_MINUTES=${1:-2}
DELAY_SECONDS=$((DELAY_MINUTES * 60))

echo "⏰ 将在 ${DELAY_MINUTES} 分钟后重启 Gateway..."
echo "📅 重启时间:$(date -d "+${DELAY_MINUTES} minutes" '+%H:%M:%S')"

sleep $DELAY_SECONDS

echo "🔄 正在重启 Gateway..."
openclaw gateway restart

echo "✅ Gateway 重启完成!"

Python 版本

#!/usr/bin/env python3
"""延迟重启 OpenClaw Gateway"""

import subprocess
import time
import sys
from datetime import datetime, timedelta

def restart_gateway(delay_minutes=2, notify=True):
    """
    延迟重启网关
    
    Args:
        delay_minutes: 延迟分钟数
        notify: 是否发送通知
    """
    restart_time = datetime.now() + timedelta(minutes=delay_minutes)
    
    print(f"⏰ 将在 {delay_minutes} 分钟后重启 Gateway")
    print(f"📅 重启时间:{restart_time.strftime('%H:%M:%S')}")
    
    # 倒计时
    for remaining in range(delay_minutes * 60, 0, -60):
        mins = remaining // 60
        secs = remaining % 60
        print(f"\r⏳ 剩余:{mins}分{secs}秒", end='', flush=True)
        time.sleep(60)
    
    print("\
🔄 正在重启 Gateway...")
    result = subprocess.run(
        ['openclaw', 'gateway', 'restart'],
        capture_output=True,
        text=True
    )
    
    if result.returncode == 0:
        print("✅ Gateway 重启成功!")
    else:
        print(f"❌ 重启失败:{result.stderr}")
    
    return result.returncode == 0

if __name__ == '__main__':
    delay = int(sys.argv[1]) if len(sys.argv) > 1 else 2
    restart_gateway(delay)

📝 完整技能结构

skills/gateway-delayed-restart/
├── SKILL.md                    # 本文档
├── restart.sh                  # Bash 版本
├── restart.py                  # Python 版本
├── _meta.json                  # 元数据
└── README.md                   # 快速说明

⚠️ 注意事项

  1. 延迟时间: 建议 1-10 分钟,不要太长
  2. 权限: 确保有执行 openclaw gateway restart 的权限
  3. 通知: 重启前最好通知相关人员
  4. 保存工作: 重启前确保保存正在进行的工作

🧪 测试清单

  • 2 分钟延迟重启
  • 立即重启 (0 分钟)
  • 5 分钟延迟重启
  • 重启后 Gateway 状态正常
  • 通知功能正常

📚 相关资源


版本: v1.1
创建时间: 2026-03-14 10:07 AM
更新时间: 2026-03-14 10:15 AM
作者: Han's AI Assistant
状态: ✅ 已创建(带完成通知)

安全使用建议
This skill appears to do exactly what it says: wait, run 'openclaw gateway restart', and optionally send a Feishu notification. Before installing, verify: (1) the host has the 'openclaw' CLI and it's authenticated to perform gateway restarts and send Feishu messages; (2) you have permission to restart the gateway (this will interrupt service); (3) the hard-coded Feishu target (ou_6650e2645a6e8f4c7363cbbfd6bbcf33) is acceptable — consider editing the script to use a configurable target or confirm it points to the correct recipient; (4) test in a safe environment (non-production) so unexpected restarts don't impact users. The main issues are omission in the manifest (declare 'openclaw' as a required binary) and the hard-coded notification target — these are operational/documentation problems, not evidence of malicious behavior.
功能分析
Type: OpenClaw Skill Name: gateway-delayed-restart Version: 1.1.0 The skill bundle contains a hardcoded Feishu target ID (ou_6650e2645a6e8f4c7363cbbfd6bbcf33) in both restart.sh and restart.py. This causes the scripts to send execution reports, including status and process IDs (PID), to an external recipient regardless of user configuration. While the primary function of restarting the gateway is legitimate, this hardcoded telemetry to a specific external entity is suspicious and could be used for tracking or minor data exfiltration.
能力评估
Purpose & Capability
The name/description (delayed restart + notification) aligns with the included scripts: both restart.sh and restart.py wait, call 'openclaw gateway restart', collect simple status info, and send a Feishu message. Small mismatch: the registry metadata lists no required binaries or env vars, but the scripts clearly require the 'openclaw' CLI and standard system utilities (pgrep, date, sleep). This is a documentation/manifest omission rather than functional misdirection.
Instruction Scope
SKILL.md and the scripts limit their actions to waiting, invoking 'openclaw gateway restart', querying the gateway PID via pgrep, printing a report, and sending a notification via 'openclaw message send'. The instructions do not read arbitrary user files, environment secrets, or contact unknown external endpoints directly (they rely on the OpenClaw CLI for messaging).
Install Mechanism
No install spec — instruction-only with bundled scripts. Files are plain shell/Python; nothing downloads or extracts remote archives. Risk from install mechanism is low.
Credentials
The skill declares no environment variables or primary credential, but it implicitly depends on the OpenClaw CLI being configured with credentials to send Feishu messages and to perform gateway restarts. That dependence is plausible for this function, but the manifest should declare the 'openclaw' CLI requirement and document that the CLI must be authenticated. Also, the notification target is hard-coded (ou_6650e264...), contrary to SKILL.md examples that imply a configurable target — this reduces flexibility and may post to an unexpected recipient if installed in a different org.
Persistence & Privilege
always is false and the skill does not persistently modify system or other skills' configurations. It requires permission to run the 'openclaw gateway restart' command (expected for its function), but it does not request elevated persistent privileges or change other skills' settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gateway-delayed-restart
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gateway-delayed-restart 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Delayed restart with completion notification via Feishu
元数据
Slug gateway-delayed-restart
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Gateway Delayed Restart 是什么?

延迟指定分钟数重启 OpenClaw Gateway,支持自定义延迟并通过飞书主动通知完成情况。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 273 次。

如何安装 Gateway Delayed Restart?

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

Gateway Delayed Restart 是免费的吗?

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

Gateway Delayed Restart 支持哪些平台?

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

谁开发了 Gateway Delayed Restart?

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

💬 留言讨论