Tech

Tutorial: Cron Job Automation dengan OpenClaw

Panduan lengkap OpenClaw Cron Jobs. Schedule tasks, reports, dan alerts yang jalan otomatis. Campuran Bahasa Indonesia dan English.
2 menit baca
4 minggu lalu
Zainul Fanani
Tutorial: Cron Job Automation dengan OpenClaw
📅 15 Apr 2026🤍 0 👁 0 🔗 0

Tutorial: Cron Job Automation dengan OpenClaw

22 menit baca - Beginner sampai Intermediate


Lo pernah kepikiran, nih.

Lo punya tugas yang berulang setiap hari. Cek email setiap pagi. Kirim report setiap sore. Check server setiap jam. Compilation tugas mingguan setiap Senin.

These tasks are predictable. Lo bisa automated. Tapi selama ini lo masih kerjain manual.

Nah, ini yang solved oleh OpenClaw Cron Jobs. Instead of doing these tasks yourself, lo tell your AI assistant when to run them. It schedules the work, executes it automatically, and delivers the results back to you.

No more forgetting to send that weekly report. No more checking your dashboard at 2 AM. Your AI assistant handles it while you focus on work that actually matters.


Kenapa Lo Butuh Scheduled Automation

Think about the things you do every day yang lo bisa automate.

Every morning lo check email dan flag urgent ones. Every evening lo send status report ke tim lo. Every hour lo check if server lo masih alive. Every Monday morning lo compile a list of what happened over the weekend.

These tasks are predictable. They follow a schedule. They do not require human creativity. But they still eat up your time, day after day.

This is exactly what OpenClaw Cron Jobs solve.


Gimana OpenClaw Cron Bekerja

OpenClaw runs cron jobs inside the Gateway process itself. This is important karena berarti scheduled tasks lo survive restarts, keep running even when lo are not at your computer, dan do not depend on any external service.

diagram
diagram

Hal penting yang harus lo understand tentang gimana cron works di OpenClaw.

Jobs persist in a JSON file. Scheduled jobs lo disimpan di ~/.openclaw/cron/jobs.json. Ini berarti kalau Gateway restarts, schedules lo gak hilang. When it comes back up, dia baca file dan resumes all pending jobs.

Jobs can run in different contexts. Some jobs need the full context of your main conversation. Others are better run in isolation so they do not clutter your main session. OpenClaw supports both.

Delivery is flexible. Results can go to a Telegram channel, a webhook endpoint, or nowhere at all if you only need the data stored internally.

One-shot jobs auto-delete. If lo schedule a reminder for a specific time, the job deletes itself after it runs successfully. Recurring jobs stay until lo delete them.


Quick Start: Lima Commands yang Perlu Lo Hafal

Ini five most important cron commands. Hafalin ini dan lo bisa set up almost any automation.

bash
# Add a one-shot reminder
openclaw cron add \
  --name "Daily Standup" \
  --at "2026-04-20T09:00:00+08:00" \
  --session isolated \
  --message "Send team a standup summary" \
  --announce

# Add a recurring job that runs every hour
openclaw cron add \
  --name "Server Health Check" \
  --cron "0 * * * *" \
  --session isolated \
  --message "Check server health, alert if down" \
  --channel telegram

# List all your scheduled jobs
openclaw cron list

# See run history for a job
openclaw cron runs --id <job-id>

# Delete a job when you no longer need it
openclaw cron delete --id <job-id>

Itu entire surface area yang lo butuhkan untuk mulai. Everything else in this guide is details.


Schedule Types: Tiga Cara buat Trigger

OpenClaw supports tiga types of schedules. Each one fits a different use case.

diagram
diagram

One-Shot Scheduling dengan --at

Pake ini buat tasks yang happen once di specific time.

bash
# Remind me in 20 minutes
openclaw cron add \
  --name "Break Reminder" \
  --at "20m" \
  --session main \
  --system-event "Take a 5-minute break" \
  --wake now \
  --delete-after-run

# Schedule for a specific date and time
openclaw cron add \
  --name "Meeting Reminder" \
  --at "2026-04-25T14:00:00+08:00" \
  --session main \
  --system-event "Team meeting starts in 15 minutes" \
  --wake now \
  --delete-after-run

Flag --wake now tells the Gateway untuk interrupt whatever it is doing dan deliver the reminder immediately. Without it, the event gets queued for the next heartbeat turn.

Interval Scheduling dengan --every

Pake ini buat tasks yang repeat at a fixed interval.

bash
# Check email every 30 minutes
openclaw cron add \
  --name "Email Check" \
  --every "30m" \
  --session isolated \
  --message "Check inbox, flag urgent emails, summarize for me"

# Heartbeat health check every 5 minutes
openclaw cron add \
  --name "Service Health" \
  --every "5m" \
  --session isolated \
  --message "Run health check on all services" \
  --announce

The interval resets after each run finishes. So a job with --every "1h" yang takes 5 minutes untuk run akan fire again 65 minutes setelah it started, not 60 minutes setelah it finished.

Cron Expression Scheduling dengan --cron

For complex schedules, pake standard 5-field cron expressions.

bash
# Every day at 9 AM
openclaw cron add \
  --name "Morning Digest" \
  --cron "0 9 * * *" \
  --tz "Asia/Makassar" \
  --session isolated \
  --message "Send me a morning briefing" \
  --announce

# Every Monday at 8 AM
openclaw cron add \
  --name "Weekly Kickoff" \
  --cron "0 8 * * 1" \
  --tz "Asia/Makassar" \
  --session isolated \
  --message "Compile last week's metrics and send summary"

# Every weekday at 6 PM
openclaw cron add \
  --name "End of Day" \
  --cron "0 18 * * 1-5" \
  --session isolated \
  --message "Generate daily status report and send to team"

# Every 15 minutes during work hours
openclaw cron add \
  --name "Hourly Sweep" \
  --cron "0 8-17 * * 1-5/15" \
  --tz "Asia/Makassar" \
  --session isolated \
  --message "Check dashboards and alert on anomalies"

Cron expressions follow standard format: minute hour day-of-month month day-of-week.

Important note: OpenClaw uses Croner's default behavior where day-of-month and day-of-week use OR logic, not AND. If lo specify both fields as non-wildcard, the job fires when either field matches. This is standard Vixie cron behavior.


Execution Styles: Where Your Job Runs

Waktu lo create a cron job, lo choose where it runs. This choice affects how much context the job has access to.

diagram
diagram

Main Session

Jobs run in your main conversation thread. They see your full conversation history dan wake the heartbeat immediately if --wake now is set.

Best for: reminders, notifications, system events that need immediate attention.

bash
openclaw cron add \
  --name "Reminder" \
  --at "2026-04-20T16:00:00Z" \
  --session main \
  --system-event "Check the cron docs draft" \
  --wake now \
  --delete-after-run

Isolated Session

Jobs run in a dedicated session dengan no prior context. The session is named after the job dan cleaned up when done.

Best for: reports, data collection, web scraping, background tasks that do not need your conversation history.

bash
openclaw cron add \
  --name "Weekly Report" \
  --cron "0 9 * * 1" \
  --session isolated \
  --message "Generate a weekly sales report and send to analytics@company.com" \
  --announce --channel telegram --to "-1001234567890"

Current Session

Jobs run in whatever session was active waktu lo create the job. The session persists across runs, jadi the job builds context over time.

Best for: daily recurring work that needs to reference previous results.

Custom Session

Jobs run in a named session lo specify. The session persists indefinitely dan accumulates context with each run.

Best for: workflows that span multiple days, kayak a week-long research project yang adds to a growing document.


Delivery: Gimana Results Nyampe ke Lo

Jobs produce output. That output has to go somewhere. OpenClaw gives lo tiga delivery modes.

diagram
diagram

Channel Delivery (Announce)

Send results directly ke a messaging channel.

bash
# Send to a Telegram channel
openclaw cron add \
  --name "Daily Summary" \
  --cron "0 18 * * *" \
  --session isolated \
  --message "Compile today's metrics and send summary" \
  --announce --channel telegram --to "-1001234567890"

# Send to a Telegram topic
openclaw cron add \
  --name "DevOps Alerts" \
  --cron "*/5 * * * *" \
  --session isolated \
  --message "Check server health, alert if issues found" \
  --announce --channel telegram --to "-1001234567890:topic:123"

For Slack and Discord, use explicit prefixes: channel:<id> or user:<id>.

Webhook Delivery

POST the results ke your own server.

bash
openclaw cron add \
  --name "Pipeline Status" \
  --cron "0 * * * *" \
  --session isolated \
  --message "Check CI/CD pipeline status" \
  --webhook "https://your-server.com/cron/pipeline-status"

The webhook receives a JSON payload with the job results, run timestamp, and metadata.

Internal Only

Keep results stored but do not send them anywhere.

bash
openclaw cron add \
  --name "Data Collector" \
  --cron "0 */2 * * *" \
  --session isolated \
  --message "Scrape competitor prices and store in database" \
  --none

Query the results later menggunakan openclaw cron runs --id <job-id>.


Payload Options for Isolated Jobs

Waktu running in isolated mode, lo can customize how the job runs.

bash
# Use a specific model
openclaw cron add \
  --name "Deep Analysis" \
  --cron "0 2 * * *" \
  --session isolated \
  --message "Run deep analysis on this week's data" \
  --model "claude-3-opus"

# Enable verbose thinking
openclaw cron add \
  --name "Careful Research" \
  --cron "0 9 * * *" \
  --session isolated \
  --message "Research competitor products and compile report" \
  --thinking "high"

# Light context mode (skip workspace bootstrap)
openclaw cron add \
  --name "Quick Check" \
  --every "15m" \
  --session isolated \
  --message "Check system metrics" \
  --light-context

# Restrict available tools
openclaw cron add \
  --name "Read Only Monitor" \
  --every "5m" \
  --session isolated \
  --message "Monitor service health" \
  --tools "read,exec"

Model selection follows a clear precedence. If lo specify --model, that takes priority. If the requested model is not allowed, it falls back to the job session model. If that is also not set, it falls back to the agent default.


Real-World Automation Examples

Ini practical automation patterns yang lo can set up today.

Example 1: Morning Briefing at 7 AM

Every weekday morning, get a briefing delivered to Telegram before lo start work.

bash
openclaw cron add \
  --name "Morning Briefing" \
  --cron "0 7 * * 1-5" \
  --tz "Asia/Makassar" \
  --session isolated \
  --message "Send me a morning briefing covering: today's calendar events, any urgent emails, server health status, and yesterday's key metrics" \
  --announce --channel telegram --to "220924719"

The AI agent runs in isolation, compiles information from your calendar, email, and monitoring tools, and sends you a clean summary. Lo arrive at work knowing what matters.

Example 2: Hourly Server Health Check

Monitor your server every 5 minutes dan alert if something goes wrong.

bash
openclaw cron add \
  --name "Health Monitor" \
  --cron "*/5 * * * *" \
  --session isolated \
  --message "Run a health check on all services. If any service is down or degraded, send an alert to Telegram with details. If everything is fine, stay silent." \
  --announce --channel telegram --to "220924719"

The conditional logic is built into the prompt. The job only talks to you when there is a problem. No spam when things are healthy.

Example 3: Weekly Report Every Monday

Generate a summary of the past week dan send it to your analytics channel.

bash
openclaw cron add \
  --name "Weekly Report" \
  --cron "0 9 * * 1" \
  --tz "Asia/Makassar" \
  --session isolated \
  --message "Compile a weekly report covering: total sales, new customer signups, support tickets resolved, server uptime percentage, and any incidents. Format as a clean markdown table." \
  --announce --channel telegram --to "-1001234567890"

Example 4: Reminder With Exact Timing

Set a one-shot reminder for a specific meeting.

bash
openclaw cron add \
  --name "Meeting Reminder" \
  --at "2026-04-25T13:45:00+08:00" \
  --session main \
  --system-event "Team sync meeting starts in 15 minutes. Join link: https://meet.example.com/sync" \
  --wake now \
  --delete-after-run

Example 5: Daily Backup Verification

Every night, verify that backups ran successfully dan report any failures.

bash
openclaw cron add \
  --name "Backup Check" \
  --cron "0 3 * * *" \
  --session isolated \
  --message "Check backup logs for today. Verify database backup and file backups completed successfully. If any backup failed, send alert with log excerpt." \
  --announce --channel telegram --to "220924719"

Cron Expression Reference

A quick reference for the most common cron patterns.

The format is: minute hour day-of-month month day-of-week


Common Pitfalls and Gotchas

Timezones. Timestamps without a timezone are treated as UTC. If lo want local time, pake flag --tz: --tz "Asia/Makassar" for WITA (UTC+8).

Day-of-month and day-of-week OR logic. If lo specify both non-wildcard values, the job fires when either matches. This catches many people off guard. 0 9 15 * 1 fires on every 15th of any month AND every Monday at 9 AM, not just Mondays that fall on the 15th.

Interval timing drift. Jobs with --every restart the timer after the job finishes, not after it starts. A 30-minute job with --every "1h" actually takes 90 minutes between runs if it takes 30 minutes to complete.

Main session waking. Jobs with --session main and --wake now interrupt the heartbeat immediately. If your agent is in the middle of something important, this might not be ideal. Pake --wake next-heartbeat for less disruptive delivery.

Model availability. If lo specify a model dengan --model yang is not in your allowed list, the job falls back silently. Check openclaw cron list after creation untuk verify the job is configured correctly.


Security Considerations

Cron jobs execute automatically without prompting for approval. Keep these points in mind.

Scope permissions carefully. If a cron job gets compromised or its prompt gets injection-attacked, what can it do? Pake --tools untuk restrict the available tools to only what the job needs.

Isolated execution is safer. Jobs running in isolated session cannot access your main conversation history. If the job only needs to read data and send a report, keep it isolated.

Webhook URLs are sensitive. If your webhook URL contains an API key or authentication token, treat it like a password. Do not put it in scripts that get committed to version control. Pake environment variables instead.

Delivery targets matter. Jobs that send to public channels or webhook endpoints should only contain information you are comfortable sharing with that audience.


Troubleshooting

My job is not running

First, verify the job exists.

bash
openclaw cron list

If the job is listed, check its status and recent run history.

bash
openclaw cron runs --id <job-id>

If the job has never run, check the Gateway logs for errors.

bash
openclaw logs --lines 50

The Gateway restarted and my jobs disappeared

They should not disappear. Jobs are stored in ~/.openclaw/cron/jobs.json and persist across restarts. If jobs are disappearing, there might be a file permission issue or the jobs file might be getting overwritten.

Check that the Gateway has write access to its config directory.

Results are not being delivered

If lo set up announce delivery but nothing arrives, check these things.

First, verify the channel ID or user ID is correct. A wrong channel ID silently drops messages.

Second, confirm the bot has permission to post in that channel. For Telegram channels, the bot must be an admin or at least have message posting rights.

Third, for webhook delivery, check your server is accessible from the Gateway and returns a 2xx status code.

The job runs but produces no output

For isolated jobs, the agent is prompted to return a plain-text summary. If the summary is empty, the prompt might need to be more specific about what output to produce.

Try adding explicit instructions in the --message field: "Format the output as a markdown table with columns X, Y, Z."


Checklist: Setting Up Your First Cron Job


Butuh VPS buat Jalankan Gateway 24/7?

Lo butuh VPS yang nyala terus supaya cron jobs bisa execute even when your computer is asleep.

Dapat SumoPod VPS - VPS hosting yang reliable dan affordable, perfect buat automation yang runs around the clock, starting dari affordable promo plans.

Versi English yang lebih teknis available di GitHub:

Read English Version on GitHub - Full technical guide with cron expressions, execution styles, delivery options, payload customization, and troubleshooting.


Referensi



Tutorial ini diverifikasi terhadap official OpenClaw documentation di docs.openclaw.ai.

Tutorial ini bagian dari project OpenClaw Sumopod - membuat automation accessible untuk UMKM Indonesia.

Last Updated: April 2026 Version: 1.0 Author: Radian IT Team

Ada Pertanyaan? Yuk Ngobrol!

Butuh bantuan setup OpenClaw, konsultasi IT, atau mau diskusi project engineering? Book a call langsung — gratis.

Book a Call — Gratis

via Cal.com • WITA (UTC+8)

📬 Subscribe Newsletter

Free

Dapat alert setiap ada artikel baru langsung ke inbox kamu. Free, no spam. 🚀

👥 Join 0+ engineers & tech enthusiasts

F

Zainul Fanani

Founder, Radian Group. Engineering & tech enthusiast.

💬 Komentar

Catatan Fanani

Ngutak-ngatik teknologi, nulis pengalaman.

Perusahaan

  • CV Radian Fokus Mandiri — Balikpapan
  • PT UNO Solusi Teknik — Balikpapan
  • PT Reka Formasi Elektrika — Jakarta
  • PT Raya Fokus Solusi — Sidoarjo
© 2026 Catatan Fanani. All rights reserved.