← 返回
AI智能 中文

Cron Doctor

Diagnose and triage cron job failures. Checks job states, identifies error patterns, prioritizes by criticality, generates health reports. Triggers on: cron...
诊断并分流定时任务故障,检查任务状态,识别错误模式,按严重程度排定优先级并生成健康报告。触发条件:cron...
suryast
AI智能 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 1,908
下载
💾 72
安装
1
版本
#latest

概述

> Compatible with Claude Code, Codex CLI, Cursor, Windsurf, and any SKILL.md-compatible agent.

Cron Doctor

Diagnose and triage cron job failures.

Usage

When asked to check cron health or diagnose failures:

1. List All Jobs

# List user's crontab
crontab -l

# List system crontabs
sudo cat /etc/crontab
ls -la /etc/cron.d/

2. Check Recent Execution

# Check cron logs (location varies by system)
# Debian/Ubuntu:
grep CRON /var/log/syslog | tail -50

# RHEL/CentOS:
tail -50 /var/log/cron

# macOS:
log show --predicate 'process == "cron"' --last 1h

# Check for specific job output
grep "your_job_name" /var/log/syslog | tail -20

3. Identify Problems

Error patterns to watch:

  • "command not found" — Missing executable or PATH issue
  • "Permission denied" — File/directory permissions wrong
  • "No such file or directory" — Script path incorrect
  • "timeout" — Job took too long
  • "ECONNREFUSED" — Network/service down
  • "rate limit" — API throttling
  • Missing output — Job may not be running at all

4. Triage Priority

PriorityCriteria
--------------------
🔴 CriticalTrading, backup, security jobs
🟠 HighUser-facing deliveries
🟡 MediumMonitoring, research jobs
🟢 LowNice-to-have, non-essential

5. Generate Report

Write to ~/workspace/reports/cron-health-YYYY-MM-DD.md:

# Cron Health Report - [DATE]

## Summary
- ✅ Healthy: X jobs
- ⚠️ Warning: X jobs  
- ❌ Failed: X jobs

## Failed Jobs

### [Job Name]
- **Error:** [message]
- **Last Success:** [date]
- **Priority:** [level]
- **Fix:** [suggested action]

## Recommendations
1. [Action item]
2. [Action item]

6. Common Fixes

ErrorFix
------------
Command not foundUse full path to executable, or set PATH in crontab
Permission deniedCheck file permissions, run chmod +x script.sh
No outputAdd >> /tmp/job.log 2>&1 to capture output
Wrong timezoneSet TZ= in crontab or use system timezone
Rate limitReduce frequency or add backoff

7. Debugging Tips

# Test cron environment (cron has minimal PATH)
env -i /bin/sh -c 'echo $PATH'

# Verify script runs manually
/path/to/your/script.sh

# Check if cron daemon is running
systemctl status cron   # Linux
launchctl list | grep cron  # macOS

Escalation

If 3+ critical jobs failed, alert the user immediately.

Verification Gates

Before claiming diagnosis complete:

  • [ ] All failed jobs listed — none skipped or ignored
  • [ ] Priority assigned — based on impact, not just recency
  • [ ] Fix suggested — actionable next step for each failure
  • [ ] Report written — to ~/workspace/reports/cron-health-YYYY-MM-DD.md
  • [ ] Critical failures escalated — 3+ critical = alert user

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-29 02:52 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

suspicious
查看报告

🔗 相关推荐

ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 710 📥 243,582
productivity

Self Monitor

suryast
主动监控基础设施、服务和健康状态,跟踪磁盘/内存/负载、服务健康、cron 任务状态及最近错误,自动修复安全...
★ 0 📥 2,055
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,057 📥 796,719