> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduling

> Learn how to schedule workflows to run automatically

## Overview

Jinba Flow allows you to schedule workflows to run automatically at specified times using cron expressions. Scheduled workflows execute the published version, making them perfect for automated tasks, periodic data processing, and scheduled reports.

## What is Scheduling?

Scheduling enables automatic execution of workflows:

* **Automatic Execution**: Workflows run automatically based on a schedule
* **Cron Expressions**: Use standard cron syntax to define execution times
* **Published Version**: Scheduled workflows always use the published version
* **Timezone Support**: Specify timezones for accurate scheduling

## Prerequisites

To schedule a workflow:

1. **Published Workflow**: The workflow must be published (see [Publish](/en/pages/basics/publish))
2. **Schedule Permission**: You need permission to schedule workflows in the workspace
3. **Cron Expression**: Define when the workflow should run

## Setting Up Scheduling

### Step 1: Open Workflow Settings

1. Open your published workflow in the Flow Editor
2. Navigate to the **Runs** or **Settings** section
3. Find the **Schedule** section

### Step 2: Enable Scheduling

1. Toggle the **Enable Schedule** switch to ON
2. The schedule configuration form appears

### Step 3: Configure Schedule

1. Enter a cron expression or use the visual schedule builder
2. Optionally specify a timezone
3. Review the schedule description (e.g., "Every day at midnight")
4. Save the schedule

### Step 4: Verify Schedule

1. Check that the schedule is active
2. View the next scheduled execution time
3. Monitor scheduled executions in the execution history

## Cron Expressions

### Basic Cron Syntax

Cron expressions consist of five fields:

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

### Common Cron Examples

#### Every Minute

```
* * * * *
```

#### Every Hour

```
0 * * * *
```

#### Daily at Midnight

```
0 0 * * *
```

#### Daily at Noon

```
0 12 * * *
```

#### Every Monday at 9 AM

```
0 9 * * 1
```

#### First Day of Every Month at Midnight

```
0 0 1 * *
```

#### Every 15 Minutes

```
*/15 * * * *
```

#### Every Day at 2:30 AM

```
30 2 * * *
```

#### Weekdays at 9 AM

```
0 9 * * 1-5
```

#### First Day of Every Quarter at Midnight

```
0 0 1 */3 *
```

## Timezone Support

### Specifying Timezone

You can specify a timezone using the `CRON_TZ` prefix:

```
CRON_TZ=America/New_York 0 9 * * *
```

This runs the workflow at 9 AM Eastern Time every day.

### Common Timezones

* `UTC`: Coordinated Universal Time
* `America/New_York`: Eastern Time
* `America/Chicago`: Central Time
* `America/Los_Angeles`: Pacific Time
* `Europe/London`: Greenwich Mean Time
* `Asia/Tokyo`: Japan Standard Time
* `Australia/Sydney`: Australian Eastern Time

**Note**: If no timezone is specified, the schedule uses UTC.

## Schedule Management

### Enabling a Schedule

1. Open workflow settings
2. Navigate to the Schedule section
3. Toggle **Enable Schedule** to ON
4. Configure the cron expression
5. Save the schedule

### Disabling a Schedule

1. Open workflow settings
2. Navigate to the Schedule section
3. Toggle **Enable Schedule** to OFF
4. The schedule is immediately disabled

**Note**: Disabling a schedule stops all future executions but doesn't affect currently running workflows.

### Updating a Schedule

1. Open workflow settings
2. Navigate to the Schedule section
3. Modify the cron expression
4. Save the changes

**Important**: Schedule updates take effect immediately. The next execution uses the new schedule.

## Scheduled Execution Behavior

### Published Version

Scheduled workflows always execute the **published version**:

* **Stability**: Uses the stable published version, not your current edits
* **Consistency**: Ensures scheduled executions use the same version
* **Updates**: Republish to update the scheduled workflow version

### Execution Context

Scheduled executions:

* **Source**: Marked as "SCHEDULE" in execution history
* **Arguments**: Use default or empty arguments (unless configured)
* **Permissions**: Run with workspace permissions
* **Logging**: All executions are logged in execution history

### Execution Monitoring

Monitor scheduled executions:

1. View execution history
2. Filter by source "SCHEDULE"
3. Check execution status and results
4. Review any errors that occurred

## Best Practices

1. **Test Before Scheduling**: Test your workflow thoroughly before scheduling
2. **Publish Stable Versions**: Only schedule workflows with stable published versions
3. **Timezone Awareness**: Always specify timezones for accurate scheduling
4. **Monitor Executions**: Regularly check execution history for scheduled runs
5. **Error Handling**: Implement error handling in workflows for scheduled execution
6. **Resource Management**: Consider resource usage for frequently scheduled workflows
7. **Documentation**: Document schedule purpose and timing in workflow description

## Common Use Cases

### Daily Reports

Schedule workflows to generate daily reports:

```
# Every day at 8 AM
0 8 * * *
```

### Data Synchronization

Schedule periodic data synchronization:

```
# Every 6 hours
0 */6 * * *
```

### Weekly Summaries

Schedule weekly summary generation:

```
# Every Monday at 9 AM
0 9 * * 1
```

### Monthly Processing

Schedule monthly data processing:

```
# First day of every month at midnight
0 0 1 * *
```

### Frequent Monitoring

Schedule frequent monitoring tasks:

```
# Every 5 minutes
*/5 * * * *
```

## Troubleshooting

### Schedule Not Running

**Possible Causes**:

* Schedule is disabled
* Workflow is not published
* Cron expression is invalid
* Workflow is archived

**Solutions**:

1. Verify schedule is enabled
2. Ensure workflow is published
3. Validate cron expression syntax
4. Check workflow is not archived

### Wrong Execution Time

**Possible Causes**:

* Timezone not specified
* Incorrect cron expression
* Timezone conversion issues

**Solutions**:

1. Specify timezone explicitly
2. Verify cron expression
3. Test with a simple schedule first

### Execution Failures

**Possible Causes**:

* Workflow errors
* Missing credentials
* Resource limitations

**Solutions**:

1. Check execution history for errors
2. Verify credentials are configured
3. Review workflow logic
4. Check resource availability

## Schedule Validation

### Cron Expression Validation

The system validates cron expressions:

* **Syntax Check**: Ensures valid cron syntax
* **Range Validation**: Validates field ranges
* **Error Messages**: Provides clear error messages for invalid expressions

### Visual Schedule Builder

Many interfaces provide visual schedule builders:

* **Point-and-Click**: Select schedule options visually
* **Preview**: See schedule description before saving
* **Validation**: Automatic validation of schedule settings

## Related Features

* [Publish](/en/pages/basics/publish) - Learn about publishing workflows
* [API](/en/pages/basics/api) - Learn about calling workflows via API
* [History and Versions](/en/pages/basics/history-versions) - Learn about execution history
