dokploy_schedule (Resource)
A cron job that Dokploy runs on a service, a remote server, or the Dokploy host.
Example Usage
# Nightly cleanup inside the container of an application.
resource "dokploy_schedule" "prune" {
name = "nightly-prune"
schedule_type = "application"
service_id = dokploy_application.web.id
cron_expression = "0 3 * * *"
command = "node scripts/prune.js"
timezone = "Africa/Johannesburg"
}
# A job on the Dokploy host takes no service_id.
resource "dokploy_schedule" "host_df" {
name = "disk-report"
schedule_type = "dokploy-server"
cron_expression = "0 8 * * 1"
shell_type = "sh"
command = "df -h /"
}Schema
Required
command(String) Command to run.cron_expression(String) Standard five-field cron expression, for example0 3 * * *. Dokploy does not validate it at write time. A malformed expression never fires.name(String) Display name.schedule_type(String) The target of the job:application,compose,server, ordokploy-server.dokploy-serverruns on the Dokploy host and takes noservice_id. A change forces a replacement.
Optional
description(String) Free-form description.enabled(Boolean) Whether the job runs. Defaults totrue. Dokploy leaves this field null for a schedule from the API alone, which is neither on nor off, and a schedule in the configuration that never fires is the worse failure.script(String) Inline script body, as an alternative to a one-linecommand.service_id(String) Id of the application, compose service, or server that the job runs on. Required for eachschedule_typeexceptdokploy-server, which has no parent. A change forces a replacement: the Dokploy update endpoint sets the new parent without a clear of the old one.service_name(String) Name of the specific container to run in, for compose services with more than one.shell_type(String) Shell for the command:bashorsh. Defaults tobash.timezone(String) IANA timezone for the cron expression, for exampleAfrica/Johannesburg. Defaults to the server timezone.
Read-Only
app_name(String) Internal Dokploy app name. The server generates it.created_at(String) Creation timestamp from the server.id(String) Schedule id.
Import
Import is supported using the following syntax:
In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:
import {
to = dokploy_schedule.prune
id = "s1a2b3c4d5e6f7g8h9i0j"
}The terraform import command can be used, for example:
terraform import dokploy_schedule.prune s1a2b3c4d5e6f7g8h9i0j