基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/caoronglin/copaw-skills --skill cron命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | cron |
| description | 通过 copaw 命令管理定时任务 - 创建、查询、暂停、恢复、删除任务 |
| triggers | ["定时任务","cron","定时","schedule","定时提醒","定时执行"] |
| metadata | {"copaw":{"emoji":"⏰"}} |
使用 copaw cron 命令管理定时任务,支持创建、查询、暂停、恢复、删除等操作。
| 频道 | 说明 |
|---|---|
imessage | iMessage |
discord | Discord |
dingtalk | 钉钉 |
qq | |
feishu | 飞书 |
console | 控制台 |
# 列出所有任务
copaw cron list
# 查看任务详情
copaw cron get <job_id>
# 查看任务状态
copaw cron state <job_id>
# 删除任务
copaw cron delete <job_id>
# 暂停任务
copaw cron pause <job_id>
# 恢复任务
copaw cron resume <job_id>
# 立即执行一次
copaw cron run <job_id>
# 创建文本消息任务
copaw cron create \
--type text \
--name "任务名称" \
--cron "CRON表达式" \
--channel 频道类型 \
--target-user "用户标识" \
--target-session "会话标识" \
--text "消息内容"
# 创建 Agent 任务
copaw cron create \
--type agent \
--name "任务名称" \
--cron "CRON表达式" \
--channel 频道类型 \
--target-user "用户标识" \
--target-session "会话标识" \
--text "提问内容"
| 参数 | 说明 | 示例 |
|---|---|---|
--type | 任务类型 | text 或 agent |
--name | 任务名称 | "每日提醒" |
--cron | Cron 表达式 | "0 9 * * *" |
--channel | 目标频道 | feishu |
--target-user | 用户标识 | 用户 ID |
--target-session | 会话标识 | 会话 ID |
--text | 消息/提问内容 | "早上好!" |
适用于复杂配置:
copaw cron create -f job_spec.json
JSON 配置示例:
{
"type": "agent",
"name": "每日待办提醒",
"cron": "0 9 * * *",
"channel": "feishu",
"target_user": "ou_xxx",
"target_session": "xxx",
"text": "查看今天的待办事项"
}
┌───────────── 分钟 (0-59)
│ ┌───────────── 小时 (0-23)
│ │ ┌───────────── 日期 (1-31)
│ │ │ ┌───────────── 月份 (1-12)
│ │ │ │ ┌───────────── 星期 (0-7, 0和7都是周日)
│ │ │ │ │
* * * * *
| 表达式 | 说明 |
|---|---|
0 9 * * * | 每天 9:00 |
0 */2 * * * | 每 2 小时 |
30 8 * * 1-5 | 工作日 8:30 |
0 0 * * 0 | 每周日零点 |
*/15 * * * * | 每 15 分钟 |
0 12 * * 1 | 每周一 12:00 |
0 9 1 * * | 每月 1 号 9:00 |
0 18 * * 5 | 每周五 18:00 |
# 每天 9:00 发送早安消息
copaw cron create \
--type text \
--name "每日早安" \
--cron "0 9 * * *" \
--channel feishu \
--target-user "ou_xxx" \
--target-session "xxx" \
--text "早上好!新的一天开始了 💪"
# 每 2 小时检查待办
copaw cron create \
--type agent \
--name "检查待办" \
--cron "0 */2 * * *" \
--channel feishu \
--target-user "ou_xxx" \
--target-session "xxx" \
--text "我有什么待办事项?"
# 每周五 18:00 生成周总结
copaw cron create \
--type agent \
--name "周总结" \
--cron "0 18 * * 5" \
--channel feishu \
--target-user "ou_xxx" \
--target-session "xxx" \
--text "帮我生成这周的工作总结"
# 每天早上查询天气
copaw cron create \
--type agent \
--name "天气提醒" \
--cron "0 7 * * *" \
--channel feishu \
--target-user "ou_xxx" \
--target-session "xxx" \
--text "今天杨凌的天气怎么样?"
copaw cron list
输出包含 job_id、名称、状态、下次执行时间等。
copaw cron state <job_id>
显示任务是否正在运行、上次执行时间、下次执行时间等。
# 暂停
copaw cron pause <job_id>
# 恢复
copaw cron resume <job_id>
copaw cron delete <job_id>
# 不等待定时,立即执行一次
copaw cron run <job_id>
copaw cron run 测试当用户需要:
| 场景 | 使用 Cron | 使用 Heartbeat |
|---|---|---|
| 精确时间 | ✅ 支持 | ⚠️ 近似 |
| 频繁检查(多次/天) | ⚠️ 资源占用 | ✅ 合并更高效 |
| 需要对话上下文 | ❌ 无 | ✅ 有 |
| 一次性提醒 | ✅ 支持 | ❌ 不支持 |
建议:
Cron Skill | 定时任务管理专家