Cron Mastery

Master OpenClaw's timing systems. Use for scheduling reliable reminders, setting up periodic

Cron Mastery is a community skill for scheduling automated tasks using OpenClaw's timing systems, covering reliable reminders, periodic maintenance jobs, scheduled workflows, cron expression creation, and janitor job configuration for time-based automation.

What Is This?

Overview

Cron Mastery provides comprehensive guidance for scheduling time-based automation in OpenClaw environments. It covers reliable reminders that trigger notifications and actions at specific times or intervals, periodic maintenance jobs called janitors that run cleanup and housekeeping tasks on defined schedules, scheduled workflows that execute complex multi-step processes at predetermined times, cron expression creation that translates natural language timing requirements into standard cron syntax, and janitor job configuration that sets up recurring tasks with proper error handling and logging. The skill helps developers build robust time-based automation without manual intervention, reducing operational overhead and ensuring consistency across environments.

Who Should Use This

This skill serves developers building automated workflows requiring time triggers, system administrators managing periodic maintenance tasks, and teams implementing scheduled data processing and reporting pipelines. It is also useful for DevOps engineers who need reliable job scheduling with built-in failure handling.

Why Use It?

Problems It Solves

Manual task execution is unreliable and does not scale when operations need to run consistently at specific times. Cron syntax is cryptic and error-prone for developers unfamiliar with its five-field format. Setting up robust scheduled jobs requires understanding proper error handling, logging, and recovery mechanisms. OpenClaw provides multiple timing systems and choosing the right approach for each use case requires domain knowledge. Without structured scheduling, teams often resort to ad hoc scripts that lack monitoring and retry logic.

Core Highlights

Reminder scheduler triggers one-time and recurring notifications at specified times. Janitor job system executes periodic maintenance with automatic retries and error handling. Cron expression generator translates human-readable schedules into standard cron syntax. Workflow scheduler orchestrates multi-step processes with time-based triggers.

How to Use It?

Basic Usage

reminders:
  - name: daily_report
    schedule: "0 9 * * *"
    action: send_notification
    message: "Time for daily standup"

janitors:
  - name: cleanup_old_logs
    schedule: "0 2 * * 0"
    task: delete_logs_older_than
    params:
      days: 30

Real-World Examples

janitors:
  - name: database_backup
    schedule: "0 1 * * *"  # 1 AM daily
    task: backup_database
    retry_on_failure: true
    max_retries: 3
    notify_on_failure: ops-team
    params:
      destination: s3://backups/
      retention_days: 90

workflows:
  - name: weekly_report_pipeline
    schedule: "0 8 * * 1"  # 8 AM Mondays
    steps:
      - task: fetch_analytics_data
        params:
          date_range: last_week
      - task: generate_report
        template: weekly_summary
      - task: send_email
        to: team@company.com
        subject: "Weekly Analytics Report"

Advanced Tips

Use janitor jobs for tasks that require robust error handling and automatic retries rather than simple reminders. Set appropriate retry limits and notification channels to catch failures without flooding alert systems. Test cron schedules using online cron expression calculators before deploying to production environments. When configuring workflows with multiple steps, ensure each step includes timeout values to prevent stalled executions from blocking subsequent scheduled runs. Staggering job start times by several minutes also helps avoid resource contention when multiple jobs share infrastructure.

When to Use It?

Use Cases

Schedule database backups to run nightly with automatic retries and failure notifications. Set up daily report generation workflows that fetch data, process it, and email summaries. Implement cleanup jobs that remove old logs, temporary files, and expired cache entries weekly. Use scheduled workflows to automate end-of-month billing processes or data synchronization tasks that must complete before business hours begin.

Related Topics

Cron syntax, scheduled tasks, job scheduling, workflow automation, task runners, background jobs, and system maintenance.

Important Notes

Requirements

OpenClaw environment with scheduler and janitor services enabled for executing time-based tasks. Proper permissions configured for scheduled jobs to access required resources like databases and external APIs. Understanding of cron expression syntax for defining schedules or willingness to use generation tools.

Usage Recommendations

Do: use janitor jobs for critical maintenance tasks that need monitoring and retries. Set up alerting for job failures so operational teams can respond to issues quickly. Document the purpose and expected behavior of each scheduled task for future maintainers.

Don't: schedule resource-intensive jobs during peak usage hours when they impact application performance. Forget to account for timezone differences when setting schedules for globally distributed systems. Create overlapping schedules where jobs might conflict or compete for the same resources.

Limitations

Cron-based scheduling has minute-level granularity and cannot trigger tasks at sub-minute intervals reliably. Long-running jobs that exceed schedule intervals may cause overlapping executions without proper locking mechanisms. System clock drift or timezone configuration errors can cause schedules to run at unexpected times.