Using Cron Jobs
Schedule automated tasks at specific times with OpenClaw cron jobs. Perfect for reminders, reports, and time-sensitive workflows.
What Are Cron Jobs?
Cron jobs in OpenClaw let you schedule tasks to run at exact timesβdaily at 9 AM, every Monday, once a month, or even one-time reminders. Unlike heartbeats (which run periodically), cron jobs give you precise control over when things happen.
Common Use Cases
- Daily reports: Send summary every morning at 8 AM
- Weekly reminders: "Check metrics" every Friday
- One-time tasks: "Call client in 3 hours"
- Monthly workflows: Invoice generation on 1st of month
- Event-based: Birthday reminders, subscription renewals
Creating Your First Cron Job
Method 1: Using the CLI
openclaw cron add --name "Morning Report" \--schedule "0 8 * * *" \--message "Generate daily metrics report"Method 2: Ask OpenClaw
The easiest wayβjust tell OpenClaw what you want:
You:
"Remind me to check my email every day at 9 AM EST"
OpenClaw:
"I've created a daily cron job that will remind you at 9 AM EST. Job ID: abc123"
Cron Schedule Syntax
Cron expressions follow this pattern: minute hour day month weekday
Common Examples:
π‘ Pro Tip:
Use crontab.guru to generate and test cron expressions visually!
Advanced: Isolated Sessions
For complex tasks, use isolated sessions. This runs the job in its own workspace without cluttering your main conversation.
Create an isolated cron job:
{
"name": "Weekly Analytics Report",
"schedule": {
"kind": "cron",
"expr": "0 9 * * 1",
"tz": "America/New_York"
},
"payload": {
"kind": "agentTurn",
"message": "Generate weekly analytics report and email to [email protected]"
},
"sessionTarget": "isolated",
"delivery": {
"mode": "announce",
"channel": "telegram"
}
}Managing Cron Jobs
List All Jobs
openclaw cron listCheck Job History
openclaw cron runs --jobId [your-job-id]Disable a Job
openclaw cron update --jobId [your-job-id] --patch '{"enabled": false}'Delete a Job
openclaw cron remove --jobId [your-job-id]Real-World Examples
π§ Daily Email Digest
Send summary of important emails every morning:
"Create cron job to check my unread emails every day at 7 AM and send me a summary"π Birthday Reminders
Get notified the day before birthdays:
"Remind me on February 14 at 9 AM: Sarah's birthday tomorrow"π Weekly Metrics
Automated reporting every Friday:
"Every Friday at 4 PM, generate a summary of this week's GitHub activity"π° Invoice Reminders
Monthly billing workflow:
"On the 1st of every month at 9 AM, remind me to send invoices"Cron Jobs vs Heartbeats
β° Cron Jobs
- Precise timing (exact time/date)
- One task per job
- Isolated sessions available
- Can deliver to specific channels
- Perfect for: Reminders, reports, scheduled workflows
π Heartbeats
- Regular intervals (every 30m, 1h)
- Multiple checks in one run
- Main session context
- Responds in current chat
- Perfect for: Monitoring, ongoing checks
Best Practices
β‘ Use Timezones
Always specify timezone in your cron jobs to avoid confusion. "tz": "America/New_York"
π Clear Job Names
Give jobs descriptive names so you can identify them later: "Weekly Sales Report" not "Job 1"
π Test First
Run jobs manually before scheduling:
openclaw cron run --jobId [id] --mode forceπ° Cost Awareness
Each cron job execution uses API credits. Be mindful of frequency and task complexity.
