Configuration File
Cron Jobs
The [[cronjobs]] section is used to define scheduled tasks that run at a specific time or interval.
Each cron job is defined as a separate [[cronjobs]] table.
# Configuration file with a cronjobs section
app = 'myapp'
[[cronjobs]]
name = 'scheduler'
schedule = '* * * * *'
command = 'php artisan schedule:run'
name
The name of the cron job is a required field that uniquely identifies it. It must adhere to the following rules:
- Uniqueness: Each cron job name must be unique within the
[[cronjobs]]list in yourdeckrun.tomlfile. Duplicate names will cause a validation error. - Formatting: The name must consist of lowercase alphanumeric characters and dashes.
- Length: The name must be between 3 and 63 characters long.
schedule
The schedule for the cron job in cron format. This is a required field.
command
The command to execute. This is a required field.
active_deadline_seconds
The maximum duration in seconds for the Kubernetes Job created by this cron job. This is an optional field.
If the job is still running when the deadline is reached, Kubernetes terminates it and marks it as failed with reason DeadlineExceeded. If omitted, no deadline is set and the job runs until it completes or fails on its own.
- Type: Integer (seconds)
- Required: No
- Default: Not set (no deadline)
- Validation: Must be between 1 and 86400 (24 hours)
app = 'myapp'
[[cronjobs]]
name = 'report-generator'
schedule = '0 2 * * *'
command = 'php artisan reports:generate'
active_deadline_seconds = 3600
Sizing your cron job
You can define the CPU and memory for a cron job using either pre-defined sizes or custom resource allocation. The options and validation rules are the same as for processes.
For detailed information on pre-defined sizes and custom resource allocation, please refer to the Sizing your process documentation.