Skip to content

Configure Cronjobs

Cronjobs allow you to schedule tasks to run at specific intervals.

Basic Cronjob Configuration

You can define cronjobs in your config.cap.yaml under the cronjobs section. Each cronjob needs a unique name, a schedule (using a cron expression), and either a command or subcommand to execute.

Note

Learn more about cron expressions in the YAML Schema Reference and subcommands in the application types documentation.

cronjobs:
  daily-cleanup:
    schedule: "0 2 * * *" # Every day at 2:00 AM UTC
    command: "php /app/cleanup.php"
    timeZone: "Europe/Amsterdam" # Optional: specify a timezone
    resources: # Optional resource allocation for this cronjob
      cpu: 100m
      memory: 256Mi
Property Type Description Default
schedule string A valid cron expression or alias (e.g., "@daily"). See YAML Schema Reference. (required)
timeZone string The timezone in which the cron schedule should be interpreted. UTC
command string or array The full command to execute (e.g., php /app/script.php). See YAML Schema Reference.
subcommand string or array The command to run using the application's framework binary (e.g., db:backup). See YAML Schema Reference.
resources object Define CPU and memory resources for this cronjob. See YAML Schema Reference. Defaults from application type