Cron & Scheduled Tasks
Overview
OpenClaw can run tasks on a schedule so your agent sends morning briefings, reminders, server health checks, or recurring reports without you having to ask every time. Scheduling is configured in your OpenClaw config and can use built-in schedules (cron-like expressions or intervals) or system cron that triggers the agent via CLI or API.
This guide covers:
- Built-in scheduled tasks (config-based)
- System cron integration (external cron + OpenClaw)
- Use cases (briefings, reminders, monitoring)
- Security and best practices
- Troubleshooting
Prerequisites
- OpenClaw installed and running (installation guide)
- At least one channel configured (e.g. Telegram or WhatsApp) so the agent can send scheduled messages
- Familiarity with the configuration file and
openclaw config edit
Built-in Scheduled Tasks
OpenClaw may support scheduled tasks defined in the config: e.g. a cron expression or interval (e.g. every day at 8:00, or every 6 hours). The exact schema depends on your OpenClaw version. Typically you define:
- Schedule: Cron expression (e.g.
0 8 * * *for 8:00 daily) or interval - Agent: Which agent runs the task
- Prompt or action: What the agent should do (e.g. “Send today’s briefing” or run a skill)
- Channel or target: Where to send the output (e.g. a specific chat or channel)
Check the official OpenClaw documentation for the current schedule syntax and examples. After adding schedules, restart the gateway and verify with openclaw status.
System Cron Integration
If your OpenClaw version does not expose built-in scheduling, or you need more control, use system cron (Linux/macOS) or Task Scheduler (Windows) to run a script that triggers the agent:
- Script: A small script (e.g. shell or Node) that calls the OpenClaw CLI or sends a request to the gateway (e.g. “Send morning briefing” or “Run health check”).
- Cron entry: Add a line to
crontab -e, e.g.0 8 * * * /path/to/openclaw-briefing.shfor 8:00 every day. - Channel delivery: The script can instruct the agent to post a message to a specific channel or user; the agent runs the logic (e.g. summarize calendar, fetch metrics) and sends the result.
This pattern is common for morning briefings, server monitoring, and habit reminders. Keep scripts minimal and do not expose the gateway port to the internet; use localhost or an internal API. See network isolation and security best practices.
Use Cases
Scheduled tasks are used across many OpenClaw workflows:
- Morning briefing: Daily digest of calendar, tasks, and news—see Morning Briefing.
- Habit tracking: Daily check-ins and reminders—see Habit Tracking.
- Server monitoring: Periodic health checks and alerts—see Server Monitoring.
- Reports and summaries: Weekly or monthly reports triggered on a schedule.
Combine schedules with memory so the agent can reference past data (e.g. “last week’s summary”) and with agent customization for the right system prompt and skills.
Security and Best Practices
- Do not expose the gateway: Scripts or cron jobs should call OpenClaw on localhost or via an internal endpoint only. See network isolation.
- Least privilege: Run cron scripts and the OpenClaw process with a dedicated user; avoid root.
- Credentials: Store API keys and tokens in environment variables or a secrets manager, not in scripts. See credential management.
- Audit: Log when scheduled tasks run and what they do; review monitoring and logging.
Troubleshooting
| Issue | Solution |
|---|---|
| Scheduled task not running | Check cron syntax and timezone; ensure the OpenClaw gateway is running; verify script path and permissions; check gateway logs. |
| Agent runs but no message in channel | Confirm channel is connected and the agent is targeting the correct chat; check channel-specific logs and channel troubleshooting. |
| Script fails with connection error | Ensure the script talks to the gateway on the correct host/port (e.g. localhost); see network isolation and troubleshooting guide. |
For more help, see the full troubleshooting guide.