Prerequisites

  • OpenClaw v1.0.0+ installed
  • API key configured
  • Linux/macOS: cron available (default on all systems) or Windows Task Scheduler
  • Basic cron syntax knowledge — use crontab.guru to build expressions

Cron Expression Reference

ExpressionDescription
0 8 * * 1-5Every weekday at 8:00 AM
*/15 * * * *Every 15 minutes
0 0 * * 0Every Sunday at midnight
0 9,17 * * *At 9 AM and 5 PM daily
30 6 1 * *First of every month at 6:30 AM
@rebootOn system reboot
# Edit your crontab
crontab -e

# Example entries
# Daily data analysis at 6 AM
0 6 * * * /home/user/scripts/daily-analysis.sh >> /var/log/openclaw-analysis.log 2>&1

# Weekly report every Monday 7 AM
0 7 * * 1 openclaw run "Generate weekly metrics report" --file ~/data/week.csv --output ~/reports/week-$(date +\%Y-\%W).md

Systemd Timers (Linux)

# /etc/systemd/system/openclaw-morning.service
[Unit]
Description=OpenClaw Morning Briefing
After=network.target

[Service]
Type=oneshot
User=youruser
ExecStart=/home/youruser/scripts/morning.sh
Environment=OPENCLAW_API_KEY=your-key

[Install]
WantedBy=multi-user.target
# /etc/systemd/system/openclaw-morning.timer
[Unit]
Description=Run OpenClaw Morning Briefing

[Timer]
OnCalendar=Mon-Fri 08:00
Persistent=true

[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now openclaw-morning.timer
sudo systemctl list-timers

Windows Task Scheduler

# Create a scheduled task via PowerShell
$action = New-ScheduledTaskAction -Execute "openclaw" `
  -Argument "run `"Generate daily report`" --output C:\Reports\daily.md" `
  -WorkingDirectory "C:\Users\user\projects"

$trigger = New-ScheduledTaskTrigger -Daily -At "08:00AM"

$settings = New-ScheduledTaskSettingsSet `
  -ExecutionTimeLimit (New-TimeSpan -Hours 1) `
  -StartWhenAvailable

Register-ScheduledTask -TaskName "OpenClaw Daily Report" `
  -Action $action -Trigger $trigger -Settings $settings `
  -RunLevel Highest

Rate Limiting Scheduled Jobs

# config.yaml — add delays between batch items
rate_limit:
  requests_per_minute: 20
  retry_on_rate_limit: true
  retry_delay_seconds: 60
  max_retries: 3

Monitoring Scheduled Jobs

Keep track of scheduled job status, execution history, and failures:

# List all scheduled OpenClaw jobs
openclaw schedule list

# Check last execution result
openclaw schedule status "daily-report"

# View execution log
tail -f /var/log/openclaw/daily-report.log

Email Notifications on Failure

#!/usr/bin/env bash
# wrapper.sh — run task and email on failure

if ! openclaw run "$1" >> /var/log/openclaw/jobs.log 2>&1; then
  echo "OpenClaw job failed: $1" | mail -s "[Alert] OpenClaw Schedule Failure" admin@example.com
  exit 1
fi

Scheduling Best Practices

  • Use absolute paths in cron commands — cron doesn't load shell profiles
  • Redirect output to a log file to capture errors: >> /var/log/openclaw.log 2>&1
  • Add rate limiting when scheduling many API calls in batch (see rate_limit config)
  • Test manually first — run the command in a terminal before adding to cron
  • Avoid overlapping runs — use flock (Linux) or -ExecutionTimeLimit (Windows) to prevent concurrent executions
  • Set MAILTO="" in crontab to suppress email if you handle logging manually

Prevent Overlapping Jobs (Linux)

# Use flock to prevent concurrent runs
*/15 * * * * flock -n /tmp/openclaw.lock openclaw run "Check for new orders" >> /var/log/openclaw.log 2>&1

Advanced Cron Patterns

Cron ExpressionMeaning
0 9 * * 1-5Weekdays at 9:00 AM
0 0 1 * *First day of each month at midnight
*/15 * * * *Every 15 minutes
0 8,12,18 * * *Three times daily (8 AM, noon, 6 PM)
@rebootOn system startup
@weeklyOnce a week (Sunday midnight)

Scheduling on Windows

Windows users can schedule OpenClaw tasks using Task Scheduler instead of cron. The approach is to create a batch file that activates the venv and runs the task, then schedule that batch file.

:: run-morning-brief.bat
@echo off
call C:\Users\you\.venv\Scripts\activate.bat
openclaw run "Generate my morning briefing" --output morning-brief.md
echo Done: %date% %time% >> C:\logs\openclaw-schedule.log

In Task Scheduler, create a new Basic Task, set the trigger (e.g. Daily at 7:00 AM), and set the action to run the batch file. For more reliable execution, check "Run whether user is logged on or not" and ensure the account has the necessary permissions.

Alternatively, if you're running WSL, you can use standard Linux cron from within the WSL environment. WSL cron will check the /etc/cron.d/ directory and run tasks even when no GUI session is active, making it the preferred approach for developer machines.

Try It Yourself

Get your first scheduled OpenClaw job running in under 5 minutes:

1 — Verify cron is running a test job

# Add a test job that runs every minute and logs the time
(crontab -l 2>/dev/null; echo "* * * * * echo "OpenClaw cron test: \$(date)" >> /tmp/cron-test.log") | crontab -

# Wait 2 minutes, then check
sleep 120
cat /tmp/cron-test.log

# Remove the test job
crontab -l | grep -v "cron-test" | crontab -

2 — Schedule a weekly report

# Every Monday at 9 AM: generate weekly changelog from git log
(crontab -l 2>/dev/null; echo "0 9 * * 1 openclaw run 'Summarise all git commits from the past 7 days into a weekly changelog' >> ~/weekly-report.md 2>&1") | crontab -

3 — Monitor a job's output

# Run OpenClaw manually once, checking all is well before scheduling
openclaw run "Check if the file /var/log/app.log has any ERROR lines from the past hour. If yes, print them. If no, print 'All clear.'" --debug

# If that works, schedule it hourly
(crontab -l 2>/dev/null; echo "0 * * * * openclaw run 'Check /var/log/app.log for errors in the last hour' >> /tmp/openclaw-hourly.log 2>&1") | crontab -
💡
Always test OpenClaw commands manually before scheduling them. Cron's environment (PATH, env vars) differs from your interactive shell — ensure your API keys are loaded via /etc/environment or a sourced dotfile.

What's Next