Loading...
Loading...
Build, test, and understand cron schedules with live preview and platform snippets
name: my-scheduled-job
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch: # Allow manual trigger
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run scheduled task
run: echo "Running scheduled task"A cron expression is a string of five (or six) fields separated by spaces that defines a schedule for recurring tasks. The standard five fields represent minute, hour, day of month, month, and day of week. Cron is used by Unix-based systems, CI/CD platforms, and cloud services to automate scheduled jobs.
The asterisk (*) is a wildcard that matches every possible value for that field. For example, an asterisk in the hour field means the job runs every hour. You can combine it with a slash for step values, like */5 in the minute field to run every 5 minutes.
Use the expression 0 0 * * *, which sets minute to 0, hour to 0, and uses wildcards for day, month, and day of week. This runs the job at 12:00 AM server time every day.
Standard (Unix) cron uses five fields: minute, hour, day of month, month, and day of week. Quartz cron adds a seconds field at the beginning and a year field at the end, giving it seven fields total. Quartz also supports special characters like L (last), W (weekday), and # (nth occurrence) that standard cron does not.
Yes. GitHub Actions uses standard five-field cron syntax inside the schedule trigger. Kubernetes CronJobs also use standard cron syntax in the spec.schedule field. Both run in UTC by default, so make sure to convert your local time accordingly.