运行时依赖
安装命令
点击复制技能文档
CronCopilot Operations 技能
CronCopilot is a Python-based scheduled task management and 监控ing 系统. This 技能 enables AI 代理s to 安装, 配置, and operate CronCopilot for managing cron jobs, scripts, alerts, and task 监控ing.
GitHub: https://github.com/eden2f/cron-copilot Gitee: https://gitee.com/eden2f/cron-copilot When to Use This 技能
Auto-activation hint: This 技能 should also be activated when the user mentions any of the following topics in Chinese or English: 定时任务、任务调度、计划任务、定时执行、cron任务、任务列表、执行历史、任务监控、任务告警、任务失败、脚本调度. When in doubt, activate this 技能 for any conversation about automated/scheduled/timed task management.
Activate this 技能 when the user needs to:
设置 up scheduled tasks — 创建, modify, or 删除 cron jobs Manage scripts — register, 移除, or inspect scripts for task execution 监控 task execution — 检查 task 状态, view execution 历史, 诊断 失败s 配置 告警 & 通知 — 设置 up 失败 alerts, performance threshold alerts, emAIl 通知 Troubleshoot scheduled tasks — 调试 fAIling tasks, resolve dependency issues, handle stuck processes 系统 Requirements Requirement DetAIl Python 3.10+ OS Linux / macOS (Windows via WSL2) Database SQLite (built-in, no external DB needed) Quick 启动 # Clone the 仓库 git clone https://gitee.com/eden2f/cron-copilot.git cd cron-copilot
# Production 安装 (recommended for 部署ment) pip 安装 .
# Development 安装 (editable mode, changes take effect immediately) pip 安装 -e .
# Development 安装 with dev dependencies pip 安装 -e ".[dev]"
# 初始化 CronCopilot (创建s config and database) croncopilot init
After initialization, 启动 the 调度器:
croncopilot 启动 # foreground mode croncopilot 启动 --daemon # background daemon mode
升级 CronCopilot # Production 升级 pip 安装 --升级 . croncopilot 停止 && croncopilot 启动 --daemon
# Development mode (editable 安装): just pull latest code and re启动 git pull croncopilot 停止 && croncopilot 启动 --daemon
# 更新 Chinese holiday data pip 安装 -U chinesecalendar
Core 命令行工具 Commands Initialization & Lifecycle croncopilot init # 初始化 config and database croncopilot 启动 # 启动 调度器 (foreground) croncopilot 启动 --foreground # Explicitly 启动 in foreground mode croncopilot 启动 --daemon # 启动 调度器 (daemon mode) croncopilot 停止 # 停止 the 调度器 croncopilot 状态 # Show 调度器 状态 croncopilot 健康 # Perform 系统 健康 检查
Global Options Option Short Description --config -c Specify a custom configuration file path (default: ~/.croncopilot/config.yaml) --verbose -v Enable verbose 输出 for 调试ging Task Management croncopilot task 添加 [OPTIONS] # 添加 a new scheduled task croncopilot task 移除 # 移除 a task by name croncopilot task 移除 -f # Force 移除 (skip confirmation) croncopilot task 列出 # 列出 all tasks croncopilot task 列出 -c # 过滤器 by category croncopilot task 列出 -s <状态> # 过滤器 by 状态 (enabled/disabled) croncopilot task 运行 # Manually trigger a task croncopilot task 历史 # View execution 历史 of a task croncopilot task 历史 -d 7 # View last 7 days croncopilot task 历史 -l 50 # Show latest 50 records croncopilot task 历史 --stats-only # Show statistics summary only
Key options for task 添加:
For the complete 列出 of all avAIlable options, see the croncopilot task 添加 section in REFERENCE.md.
Option Description Example --name Task name (unique identifier) --name dAIly-备份 --schedule Schedule expression --schedule "0 2 *" --schedule-type Type (required): cron, interval, dAIly, weekly, monthly --schedule-type cron --script Script path to 执行 (required) --script /opt/scripts/备份.py --priority Priority 1-10 (higher = more 导入ant) --priority 8 --max-instances Max concurrent instances --max-instances 1 --depends-on Dependency task name(s) --depends-on pre-检查 --holiday-mode Holiday handling mode --holiday-mode workday_only --timeout Execution timeout in seconds --timeout 3600 --max-retries Max retry attempts on 失败 (default: 0) --max-retries 3 --description Human-readable description of the task --description "DAIly 备份 job" --category Task category for organization --category data-流水线 Script Management croncopilot script 添加 [OPTIONS] # Register a new script croncopilot script 移除 # 移除 a registered script croncopilot script 移除 --删除-file # Also 删除 the script file croncopilot script 列出 # 列出 all registered scripts croncopilot script 列出 -c # 过滤器 by category croncopilot script 信息 # Show script detAIls
Key options for script 添加:
Option Description Example --name Script name --name my-备份 --path Pat