dokploy_schedule (Resource)
A cron job Dokploy runs against a service, a remote server, or the Dokploy host itself.
Example Usage
# Nightly cleanup inside an application's container.
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 itself 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, e.g.0 3 * * *. Dokploy does not validate it at write time; a malformed expression simply never fires.name(String) Display name.schedule_type(String) What the job runs against:application,compose,server, ordokploy-server.dokploy-serverruns on the Dokploy host itself and takes noservice_id. Changing this forces replacement.
Optional
description(String) Free-form description.enabled(Boolean) Whether the job runs. Defaults totrue: Dokploy leaves this null when a schedule is created through the API alone, which is neither on nor off, and a schedule declared in configuration that silently 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 this runs against. Required for everyschedule_typeexceptdokploy-server, which has no parent. Changing it forces replacement: Dokploy’s update endpoint sets the new parent without clearing 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 the command runs under:bashorsh.timezone(String) IANA timezone the cron expression is evaluated in, e.g.Africa/Johannesburg. Defaults to the server’s timezone.
Read-Only
app_name(String) Dokploy-internal app name, generated by the server.created_at(String) Creation timestamp (server-side).id(String) Schedule id.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dokploy_schedule.prune s1a2b3c4d5e6f7g8h9i0j