Skip to main content
Cron Jobs

Create a cron job on a server

Asynchronous Request

Schedules a cron entry for the selected server and stores the job in Webdock metadata. Only one cron job mutation can run at a time per server; if another cron create/pause/unpause/delete operation is in progress, this request returns HTTP 400 until that operation completes.

POST
/servers/{serverSlug}/cronjobs
Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

serverSlugstringrequired

Slug of the server where the cron entry should be created

Body

application/json

Cron job create payload for a specific server

commandstringrequired

Shell command to execute. Required.

daystring

Cron day-of-month expression. Accepts '*', values 1-31, ranges, steps, and comma lists. Defaults to * when omitted.

Example: *
dayOfWeekstring

Cron day-of-week expression. Accepts '*', values 0-7 or SUN-SAT, ranges, steps, and comma lists. Defaults to * when omitted.

Example: 1-5
hourstring

Cron hour expression. Accepts '*', values 0-23, ranges, steps, and comma lists. Defaults to * when omitted.

Example: 3
minutestring

Cron minute expression. Accepts '*', values 0-59, ranges (for example 5-10), step syntax with '/', and comma lists. Defaults to * when omitted.

Example: 0
monthstring

Cron month expression. Accepts '*', values 1-12 or JAN-DEC, ranges, steps, and comma lists. Defaults to * when omitted.

Example: *
userstring

User the command runs as. Defaults to root when omitted.

Example: root

Response

application/json

Create cron job request accepted

X-Callback-IDstringheader

CallbackID

commandstring

Command executed by cron

createdstring

Datetime the cron job was created in Webdock metadata

daystring

Cron day-of-month expression

dayOfWeekstring

Cron day-of-week expression

hourstring

Cron hour expression

idinteger

Cron job ID from Webdock metadata storage

isPausedboolean

True when the cron job is paused in Webdock metadata

minutestring

Cron minute expression

monthstring

Cron month expression

userstring

User the cron command runs as

Example: root