Isaac Zarzuri

EZ Cronjob

开发编程v1.0.0
作者:Isaac Zarzuri更新于 2026-05-17ez-cronjob@clawhub_promadgenius/ez-cronjob
Bug 修复脚本工具#Cron Job#Message

据 AlphaMoat 统计,截至 2026-09,EZ Cronjob 累计下载 4,736 次、获 5 个星标,在全部 5,078 个 AI 技能中排名第 1,995 位,在「开发编程」分类(577 个)中排名第 256 位。

累计安装
156
累计下载
4,736
星标
5
全站排名
#1,995
全站前 40% · 「开发编程」前 45%
平台累计安装累计下载星标评论
ClawHub ↗1564,55852
SkillHub ↗1554,7365—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

涵盖定时消息投递、超时、时区错误和模型回退问题,并提供可靠性排查建议。删除任务、立即执行或重启网关可能造成工作丢失、意外发送或服务中断;需先核验任务 ID、接收频道和具体动作。 需要兼容 Clawdbot/Moltbot CLI 和 gateway 访问。来源针对所记故障推荐 CLI 诊断、隔离会话、明确时区及投递/频道参数,应用例子前核实已安装版本行为;这些模式不保证送达,也不证明超时同因。日志限 cron 相关行,任何发送测试前确认接收方。

资料发布于 2026-10-27

可以用来做什么

  • 诊断定时消息未投递或时区错误
  • 检查 cron 超时和模型回退问题

什么时候用

  • 在查看日志或更改调度前确认工作范围和目标频道时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

整理排查定时任务投递失败的只读检查步骤。
列出删除或立即运行某个 cron 任务前必须确认的内容。

月度数据趋势

累计下载4,736
3,9254,3614,7962026-05 · 累计下载 3,9852026-06 · 累计下载 4,1252026-07 · 累计下载 4,3492026-08 · 累计下载 4,4602026-09 · 累计下载 4,73626-0526-09
星标5
4562026-05 · 星标 52026-06 · 星标 52026-07 · 星标 52026-08 · 星标 52026-09 · 星标 526-0526-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,736—5
2026-084,460+2.6%5
2026-074,349+5.4%5
2026-064,125+3.5%5
2026-053,985—5

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

8.6 KB · ClawHub v1.0.0
---
name: ez-cronjob
description: Fix common cron job failures in Clawdbot/Moltbot - message delivery issues, tool timeouts, timezone bugs, and model fallback problems.
author: Isaac Zarzuri
author-url: https://x.com/Yz7hmpm
version: 1.0.0
homepage: https://www.metacognitivo.com
repository: https://github.com/ProMadGenius/clawdbot-skills
metadata: {"agentskills":{"category":"troubleshooting","tags":["cron","scheduling","telegram","debugging","moltbot","clawdbot"]}}
---
展开全部(共 365 行)

# Cron Job Reliability Guide

A comprehensive guide to diagnosing and fixing cron job issues in Clawdbot/Moltbot. This skill documents common failure patterns and their solutions, learned through production debugging.

## When to Use This Skill

Use this skill when:
- Scheduled messages aren't being delivered
- Cron jobs show "error" status
- Messages arrive at wrong times (timezone issues)
- The agent times out when using the `cron` tool
- Fallback models ignore instructions and call tools unexpectedly

## Quick Reference

### The Golden Rule

**Always use these flags together for reliable delivery:**

```bash
clawdbot cron add \
  --name "my-job" \
  --cron "0 9 * * 1-5" \
  --tz "America/New_York" \
  --session isolated \
  --message "[INSTRUCTION: DO NOT USE ANY TOOLS] Your prompt here" \
  --deliver --channel telegram --to "CHAT_ID" \
  --best-effort-deliver
```

### Essential Flags Explained

| Flag | Purpose | Why It Matters |
|------|---------|----------------|
| `--session isolated` | Creates dedicated session | Prevents message loss in busy conversations |
| `--tz "TIMEZONE"` | Sets explicit timezone | Avoids UTC confusion |
| `--deliver` | Sends to channel | Required for Telegram/WhatsApp |
| `--best-effort-deliver` | Don't fail on delivery error | Graceful degradation |

---

## Problem 1: Internal `cron` Tool Deadlock

### Symptoms
- Agent times out (10s) when calling `cron list` or `cron add`
- Error: "Tool execution timed out"
- Gateway logs show 80s+ response times

### Root Cause
The internal `cron` tool creates a deadlock between the agent process and gateway.

### Solution
**Never use the `cron` tool directly.** Use `exec` (or `bash`) instead:

```bash
# CORRECT - uses exec to bypass deadlock
exec: clawdbot cron list
exec: clawdbot cron add --name "reminder" --at "+5m" --message "Hello"

# INCORRECT - causes timeout
cron list        # DO NOT USE
cron add ...     # DO NOT USE
```

### For Agents
If you're an AI agent reading this: when the user asks you to manage cron jobs, **always use the exec/bash tool** to run `clawdbot cron` commands. Never invoke the `cron` tool directly.

---

## Problem 2: Messages Not Delivered

### Symptoms
- Job shows "ok" status but message never arrives
- Works in testing but fails on schedule
- Intermittent delivery

### Root Cause
Using `--session main` or `--system-event` causes messages to get lost when there's an active conversation in the main session.

### Solution
**Always use `--session isolated`:**

```bash
# CORRECT - isolated session, guaranteed delivery
clawdbot cron add \
  --name "daily-standup" \
  --cron "0 9 * * 1-5" \
  --session isolated \
  --deliver --channel telegram --to "-100XXXXXXXXXX"

# INCORRECT - messages can be lost
clawdbot cron add \
  --name "daily-standup" \
  --session main \
  --system-event \
  ...
```

### Verification
After creating a job, test it:

```bash
# Run the job immediately to verify delivery
clawdbot cron run <job-id>
```

---

## Problem 3: Wrong Execution Time

### Symptoms
- Job runs 4-5 hours early or late
- Schedule shows correct time but execution is off
- Works correctly sometimes, fails other times

### Root Cause
Missing timezone specification defaults to UTC.

### Solution
**Always specify timezone explicitly:**

```bash
# CORRECT - explicit timezone
clawdbot cron add \
  --cron "0 9 * * 1-5" \
  --tz "America/New_York" \
  ...

# INCORRECT - defaults to UTC
clawdbot cron add \
  --cron "0 9 * * 1-5" \
  ...
```

### Common Timezone IDs

| Region | Timezone ID |
|--------|-------------|
| US Eastern | `America/New_York` |
| US Pacific | `America/Los_Angeles` |
| UK | `Europe/London` |
| Central Europe | `Europe/Berlin` |
| India | `Asia/Kolkata` |
| Japan | `Asia/Tokyo` |
| Australia Eastern | `Australia/Sydney` |
| Brazil | `America/Sao_Paulo` |
| Bolivia | `America/La_Paz` |

---

## Problem 4: Fallback Models Ignore Instructions

### Symptoms
- Primary model works correctly
- When fallback activates, agent calls tools unexpectedly
- Agent tries to use `exec`, `read`, or other tools when it shouldn't

### Root Cause
Some fallback models (especially smaller/faster ones) don't follow system instructions as strictly as primary models.

### Solution
**Embed instructions directly in the message:**

```bash
# CORRECT - instruction embedded in message
clawdbot cron add \
  --message "[INSTRUCTION: DO NOT USE ANY TOOLS. Respond with text only.] 
  
  Generate a motivational Monday message for the team."

# INCORRECT - relies only on system prompt
clawdbot cron add \
  --message "Generate a motivational Monday message for the team."
```

### Robust Message Template

```text
[INSTRUCTION: DO NOT USE ANY TOOLS. Write your response directly.]

Your actual prompt here. Be specific about what you want.
```

---

## Problem 5: Job Stuck in Error State

### Symptoms
- Job status shows "error"
- Subsequent runs also fail
- No clear error message

### Diagnosis

```bash
# Check job details
clawdbot cron show <job-id>

# Check recent logs
tail -100 /tmp/clawdbot/clawdbot-$(date +%Y-%m-%d).log | grep -i cron

# Check gateway errors
tail -50 ~/.clawdbot/logs/gateway.err.log
```

### Common Causes and Fixes

| Cause | Fix |
|-------|-----|
| Model quota exceeded | Wait for quota reset or switch model |
| Invalid chat ID | Verify channel ID with `--to` |
| Bot removed from group | Re-add bot to Telegram group |
| Gateway not running | `clawdbot gateway restart` |

### Nuclear Option

If nothing works:

```bash
# Remove the problematic job
clawdbot cron rm <job-id>

# Restart gateway
clawdbot gateway restart

# Recreate with correct flags
clawdbot cron add ... (with all recommended flags)
```

---

## Debugging Commands

### View All Jobs

```bash
clawdbot cron list
```

### Inspect Specific Job

```bash
clawdbot cron show <job-id>
```

### Test Job Immediately

```bash
clawdbot cron run <job-id>
```

### Check Logs

```bash
# Today's logs filtered for cron
tail -200 /tmp/clawdbot/clawdbot-$(date +%Y-%m-%d).log | grep -i cron

# Gateway errors
tail -100 ~/.clawdbot/logs/gateway.err.log

# Watch logs in real-time
tail -f /tmp/clawdbot/clawdbot-$(date +%Y-%m-%d).log | grep --line-buffered cron
```

### Restart Gateway

```bash
clawdbot gateway restart
```

---

## Complete Working Examples

### Daily Standup Reminder (9 AM, Mon-Fri)

```bash
clawdbot cron add \
  --name "daily-standup-9am" \
  --cron "0 9 * * 1-5" \
  --tz "America/New_York" \
  --session isolated \
  --message "[INSTRUCTION: DO NOT USE ANY TOOLS. Write directly.]

Good morning team! Time for our daily standup.

Please share:
1. What did you accomplish yesterday?
2. What are you working on today?
3. Any blockers?

@alice @bob" \
  --deliver --channel telegram --to "-100XXXXXXXXXX" \
  --best-effort-deliver
```

### One-Shot Reminder (20 minutes from now)

```bash
clawdbot cron add \
  --name "quick-reminder" \
  --at "+20m" \
  --delete-after-run \
  --session isolated \
  --message "[INSTRUCTION: DO NOT USE ANY TOOLS.]

Reminder: Your meeting starts in 10 minutes!" \
  --deliver --channel telegram --to "-100XXXXXXXXXX" \
  --best-effort-deliver
```

### Weekly Report (Friday 5 PM)

```bash
clawdbot cron add \
  --name "weekly-report-friday" \
  --cron "0 17 * * 5" \
  --tz "America/New_York" \
  --session isolated \
  --message "[INSTRUCTION: DO NOT USE ANY TOOLS.]

Happy Friday! Time to wrap up the week.

Please share your weekly highlights and any items carrying over to next week." \
  --deliver --channel telegram --to "-100XXXXXXXXXX" \
  --best-effort-deliver
```

---

## Checklist for New Cron Jobs

Before creating any cron job, verify:

- [ ] Using `exec: clawdbot cron add` (not the `cron` tool directly)
- [ ] `--session isolated` is set
- [ ] `--tz "YOUR_TIMEZONE"` is explicit
- [ ] `--deliver --channel CHANNEL --to "ID"` for message delivery
- [ ] `--best-effort-deliver` for graceful failures
- [ ] Message starts with `[INSTRUCTION: DO NOT USE ANY TOOLS]`
- [ ] Tested with `clawdbot cron run <id>` after creation

---

## Related Resources

- [Clawdbot Cron Documentation](https://docs.molt.bot/tools/cron)
- [Timezone Database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
- [Cron Expression Generator](https://crontab.guru/)

---

*Skill authored by Isaac Zarzuri. Based on production debugging experience with Clawdbot/Moltbot.*

「开发编程」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。