AgentSkillsCN

cron-scheduler-skill

使用 Cron 表达式安排周期性任务。按照日、周、小时等时间表运行工作流。

SKILL.md
--- frontmatter
name: cron-scheduler-skill
description: Schedule recurring tasks using cron expressions. Run workflows on schedules (daily, weekly, hourly, etc.).
allowed-tools: cron_scheduler
metadata:
  author: machina
  version: "1.0"
  category: automation
  icon: "📅"
  color: "#8B5CF6"

Cron Scheduler Tool

Schedule recurring tasks using cron expressions.

How It Works

This skill provides instructions for the Cron Scheduler tool node. Connect the Cron Scheduler node to Zeenie's input-tools handle or use as a workflow trigger.

cron_scheduler Tool

Create recurring schedules using cron expressions.

Schema Fields

FieldTypeRequiredDescription
expressionstringYesCron expression (5 fields)
timezonestringNoTimezone (default: UTC)

Cron Expression Format

code
* * * * *
│ │ │ │ │
│ │ │ │ └── Day of week (0-7, Sun=0 or 7)
│ │ │ └──── Month (1-12)
│ │ └────── Day of month (1-31)
│ └──────── Hour (0-23)
└────────── Minute (0-59)

Special Characters

CharacterMeaningExample
*Any value* * * * * (every minute)
,List of values1,15 * * * * (minute 1 and 15)
-Range1-5 * * * * (minutes 1-5)
/Step values*/15 * * * * (every 15 minutes)

Common Patterns

PatternDescriptionCron Expression
Every minuteRuns each minute* * * * *
Every 5 minutesRuns at :00, :05, :10...*/5 * * * *
Every 15 minutesRuns at :00, :15, :30, :45*/15 * * * *
Every hourRuns at minute 00 * * * *
Every day at 9 AMMorning job0 9 * * *
Every day at midnightNightly job0 0 * * *
Weekdays at 9 AMMon-Fri morning0 9 * * 1-5
Every MondayWeekly on Monday0 0 * * 1
First of monthMonthly job0 0 1 * *
Every Sunday at 6 PMWeekly Sunday evening0 18 * * 0
Multiple times daily8am, noon, 6pm0 8,12,18 * * *

Examples

Every day at 9 AM:

json
{
  "expression": "0 9 * * *",
  "timezone": "America/New_York"
}

Every 30 minutes:

json
{
  "expression": "*/30 * * * *"
}

Weekdays at 6 PM:

json
{
  "expression": "0 18 * * 1-5",
  "timezone": "Europe/London"
}

Every Monday at 10 AM:

json
{
  "expression": "0 10 * * 1",
  "timezone": "Asia/Tokyo"
}

First day of each month:

json
{
  "expression": "0 0 1 * *"
}

Response Format

Schedule created:

json
{
  "success": true,
  "message": "Cron schedule created",
  "expression": "0 9 * * *",
  "timezone": "America/New_York",
  "next_run": "2025-01-31T09:00:00-05:00",
  "description": "At 09:00 AM, every day"
}

Schedule triggered:

json
{
  "success": true,
  "triggered": true,
  "message": "Cron schedule triggered",
  "expression": "0 9 * * *",
  "triggered_at": "2025-01-30T09:00:00Z"
}

Error Response

json
{
  "error": "Invalid cron expression: too few fields"
}

Timezone Reference

TimezoneDescription
UTCUniversal Time (default)
America/New_YorkEastern US
America/Los_AngelesPacific US
Europe/LondonUK
Europe/ParisCentral Europe
Asia/TokyoJapan
Asia/ShanghaiChina
Australia/SydneyAustralia Eastern

Use Cases

Use CaseExpressionDescription
Daily report0 9 * * *Generate daily reports
Hourly sync0 * * * *Sync data hourly
Weekly backup0 2 * * 0Sunday at 2 AM
Business hours check*/30 9-17 * * 1-5Every 30 min, 9-5 Mon-Fri
Monthly cleanup0 0 1 * *First of month

Common Workflows

Daily notification

  1. Set cron for desired time (e.g., 0 9 * * *)
  2. Cron triggers → workflow runs
  3. Send notification to user

Scheduled data sync

  1. Set cron for sync interval (e.g., 0 * * * *)
  2. Cron triggers → fetch data
  3. Process and store data

Weekly report

  1. Set cron for weekly (e.g., 0 10 * * 1)
  2. Cron triggers → generate report
  3. Send report via email/WhatsApp

Workflow-Based Scheduling

In this system, scheduling works through:

  1. Trigger Node: Use Cron Scheduler as workflow start
  2. Deployment: Deploy workflow to activate schedule
  3. Cancellation: Undeploy workflow to stop schedule

Each trigger creates independent workflow runs.

Best Practices

  1. Use UTC for global: Avoid timezone confusion
  2. Consider load: Don't schedule many jobs at :00
  3. Stagger jobs: Use :05, :10 instead of all at :00
  4. Test expressions: Verify with online cron tools
  5. Document schedules: Keep track of what runs when

Limitations

  • Requires workflow deployment to activate
  • Cannot schedule past events
  • Minimum granularity is 1 minute
  • Complex conditions need multiple schedules

Setup Requirements

  1. Connect the Cron Scheduler node to Zeenie's input-tools handle
  2. Or use as workflow trigger (first node)
  3. Deploy workflow to activate the schedule
  4. Undeploy to cancel the schedule