ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

universal-autostart

Cross-platform auto-start service manager for Windows and macOS. Supports installing, uninstalling, starting, stopping, and monitoring services with automatic restart. Use when you need to set up persistent background services that survive system reboots on Windows (sc/schtasks) or macOS (launchd).

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/ahao2001/universal-autostart
Or

Universal AutoStart Service Manager v1.1

跨平台的自启动服务管理器,支持 Windows 和 macOS。可以安装、卸载、启动、停止和监控服务,并支持自动重启。

🚀 快速开始

Windows 安装

创建 install_windows.bat 文件(纯文本,保存为 UTF-8 编码):

@echo off
chcp 65001 >nul
echo ============================================================
echo   通用自启动服务 - 安装工具 v1.1
echo ============================================================

:: 检查管理员权限
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo [ERROR] 请以管理员身份运行此脚本!
    pause
    exit /b 1
)

echo [OK] 管理员权限已获取

:: 查找配置文件
set CONFIG_FILE=%~dp0service_config.json
if not exist "%CONFIG_FILE%" (
    set CONFIG_FILE=%~dp0qwenpaw_service_config.json
)

if not exist "%CONFIG_FILE%" (
    echo [ERROR] 未找到配置文件!
    pause
    exit /b 1
)

:: 安装服务
python "%~dp0universal_service.py" install "%CONFIG_FILE%" --no-check-admin

if %errorLevel% equ 0 (
    echo [OK] 安装完成!服务将在下次开机自动启动
) else (
    echo [ERROR] 安装失败!
)

pause

右键点击 install_windows.bat以管理员身份运行

macOS 安装

使用已提供的 install_macos.sh

sudo ./install_macos.sh

📋 核心功能

功能描述
跨平台支持Windows (sc + schtasks), macOS (launchd)
自动重启服务崩溃时自动重启(可配置最大重启次数)
日志记录实时日志输出,支持文件轮转
健康检查端口/进程检测,确保服务正常运行
优雅退出支持 SIGTERM/SIGINT 信号处理
环境变量支持加载 .env 文件

🔧 使用方式

命令行操作

# 安装自启动(不立即运行)
python universal_service.py install [config.json] [--no-check-admin]

# 卸载自启动
python universal_service.py uninstall [config.json] [--no-check-admin]

# 手动启动服务
python universal_service.py start [config.json]

# 停止服务
python universal_service.py stop [config.json]

# 查看服务状态
python universal_service.py status [config.json]

# 直接运行(带自启动)
python universal_service.py [config.json]

双击脚本

  • Windows: install.bat / uninstall.bat
  • macOS: install_macos.sh / uninstall_macos.sh

⚙️ 配置文件

QwenPaw 标准配置 (qwenpaw_service_config.json)

{
  "service_name": "QwenPawService",
  "display_name": "QwenPaw 智能助手服务",
  "program": {
    "type": "python",
    "path": "python",
    "arguments": "-m qwenpaw.cli",
    "working_dir": "C:/Users/Administrator/.copaw/workspaces/default"
  },
  "environment": {
    "load_dotenv": true,
    "variables": {}
  },
  "log": {
    "enabled": true,
    "level": "INFO",
    "dir": ".logs",
    "max_size_mb": 10,
    "backup_count": 5,
    "console": true
  },
  "health_check": {
    "enabled": true,
    "type": "port",
    "port": 8765,
    "interval_seconds": 30,
    "timeout_seconds": 5,
    "max_failures": 3
  },
  "restart": {
    "auto_restart": true,
    "max_restarts": 5,
    "restart_delay": 30
  }
}

通用示例配置 (service_config.example.json)

{
  "service_name": "MyCustomService",
  "display_name": "我的自定义服务",
  "program": {
    "type": "python",
    "path": "python3",
    "arguments": "app.py",
    "working_dir": "/p...

Metadata

Author@ahao2001
Stars4473
Views0
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-ahao2001-universal-autostart": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.

Related Skills

teaching-materials

中小学教学文档智能生成工具。当用户需要制作课件(PPT)、编写教学设计(教案)、或创建学生任务单(导学案)时使用此技能。支持数学、语文等学科的备课、课堂巩固、课后作业等教学场景的文档生成。

ahao2001 4473

CSP课件制作技能

这个技能用于为信息学/CSP竞赛 C++ 课程(小学高年级到初中竞赛班)生成完整的教学资料套件:游戏化趣味课件(.pptx)、详细教案(.docx)、学生任务单(.docx)、代码示例(.cpp)以及网页版互动闯关游戏(.html)。支持单课制作和批量(从PDF教材)批量生成全套课程资料。当用户需要制作 C++/CSP/信奥/NOIP 编程课课件、教案、任务单,或需要从PDF教材批量生成课程资料时应使用此技能。触发词:CSP课件、信奥课件、NOIP课件、C++课件、编程课件、CSP教案、信奥教案、做课件、做教案、做任务单、PPT三件套、批量生成课件、PDF转课件。

ahao2001 4473

teacher-ai-preparing-lesson

中小学教师智能备课助手。当用户需要准备课件(PPT)、教案(教学设计)、学生任务单(导学案)时使用此技能。支持数学、语文、英语等学科的备课、课堂巩固、课后作业等教学场景的文档生成。本技能会自动生成完整的备课资料包,包括课件、教案、任务单、参考资料下载和辅助教学HTML工具。激活词:tapl、备课、备课助手、做课件、写教案、教学助手、teaching、设计任务单、导学案。

ahao2001 4473

zhouyi-divination

基于《周易》的完整占卜系统,支持铜钱起卦 + 八字排盘 + 综合解读

ahao2001 4473