Skip to content

Cron Sink

The Cron sink allows you to trigger workflow executions on a schedule using standard cron expressions.

When running the desktop app, Flow-Like uses a local scheduler to trigger executions:

┌──────────────┐
│ Flow-Like │
│ Desktop │
│ ┌────────┐ │
│ │ Cron │──┼──► Trigger Execution
│ │ Sched. │ │
│ └────────┘ │
└──────────────┘

Advantages:

  • Works offline
  • No server required
  • Uses local system time

Limitations:

  • Computer must be running
  • Missed executions when computer is off

When deployed to a server, the scheduler runs continuously:

┌──────────────┐
│ Flow-Like │
│ Server │
│ ┌────────┐ │
│ │ Cron │──┼──► Trigger Execution
│ │ Sched. │ │
│ └────────┘ │
└──────────────┘

Advantages:

  • Runs 24/7
  • Reliable execution
  • No missed schedules

| Field | Type | Description | Required | |-------|------|-------------|----------| | expression | string | Cron expression | Yes | | timezone | string | Timezone (e.g., America/New_York) | No | | enabled | boolean | Whether the schedule is active | No |

Standard 5-field cron format:

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday = 0)
│ │ │ │ │
│ │ │ │ │
* * * * *

| Character | Description | Example | |-----------|-------------|---------| | * | Any value | * * * * * (every minute) | | , | List | 1,15,30 * * * * (at 1, 15, 30 min) | | - | Range | 1-5 * * * * (minutes 1-5) | | / | Step | */15 * * * * (every 15 minutes) |

| Expression | Description | |------------|-------------| | 0 * * * * | Every hour at minute 0 | | 0 9 * * * | Every day at 9:00 AM | | 0 9 * * 1-5 | Weekdays at 9:00 AM | | */15 * * * * | Every 15 minutes | | 0 0 1 * * | First day of month at midnight | | 0 12 * * 0 | Sundays at noon | | 30 4 1,15 * * | 1st and 15th at 4:30 AM |

By default, cron expressions use the system timezone (local mode) or server timezone (remote mode). You can override this:

{
"expression": "0 9 * * *",
"timezone": "America/New_York"
}
  • UTC - Coordinated Universal Time
  • America/New_York - Eastern Time
  • America/Los_Angeles - Pacific Time
  • Europe/London - British Time
  • Europe/Berlin - Central European Time
  • Asia/Tokyo - Japan Standard Time

Cron triggers receive a payload with execution context:

{
"trigger": "cron",
"scheduled_time": "2024-01-15T09:00:00Z",
"actual_time": "2024-01-15T09:00:01Z",
"expression": "0 9 * * *",
"timezone": "UTC"
}

If the computer was off during a scheduled time:

  • Default: The execution is skipped
  • Execution resumes at the next scheduled time

With proper server infrastructure, missed executions shouldn't occur. However, if the server was down:

  • The execution is skipped
  • Consider using persistent job queues for critical schedules

Generate and send a daily report every morning:

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

Sync data every hour:

{
"expression": "0 * * * *"
}

Run backup every Sunday at 2 AM:

{
"expression": "0 2 * * 0"
}

Process on the last day of each month:

{
"expression": "0 23 28-31 * *"
}

The sink status indicates:

  • Whether the schedule is active
  • Next scheduled execution time
  • Last execution time and result

All cron executions are logged with:

  • Scheduled vs actual execution time
  • Run ID for tracking
  • Execution result
  1. Use specific times when possible - avoid * * * * * unless truly needed
  2. Consider timezones - be explicit to avoid confusion
  3. Avoid overlapping - ensure previous run completes before next starts
  4. Add buffer time - schedule a few minutes after the hour to avoid clock drift issues
  5. Monitor execution - check that scheduled jobs are running
  6. Test expressions - verify your cron expression does what you expect

Test your cron expressions:

  • Minimum interval: 1 minute
  • Maximum schedules per event: Depends on hub configuration
  • Execution timeout: Follows standard workflow timeout settings