cPanel/Cron
cPanel module

Cron

4 functions, invoked through the cpanel_uapi tool.

List, add, edit or remove the account's cron jobs

scope cpanel:uapideploy
Call any function with cpanel_uapi(service_id, module="Cron", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

add_line POST mutating#

Add a cron job

This function adds a cron job to the account's crontab.

JetHost note: command must be a single line (cPanel rejects newlines); escape a literal % as \% because crontab treats an unescaped % as a newline; an invalid schedule is rejected when the crontab is installed. There is no MAILTO support — redirect output inside the command to avoid cron mail. The response carries the new job's linekey.

commandstringRequired
The command to run. It must be a single line (cPanel rejects newlines). Escape a literal % as \% — crontab treats an unescaped % as a newline. Redirect output inside the command (e.g. >/dev/null 2>&1) to avoid cron mail; there is no MAILTO support.
minutestringRequired
The minute field of the schedule (0-59, , lists, ranges or steps such as /15).
hourstringRequired
The hour field of the schedule (0-23, *, lists, ranges or steps).
daystringRequired
The day-of-month field of the schedule (1-31 or *).
monthstringRequired
The month field of the schedule (1-12 or *).
weekdaystringRequired
The day-of-week field of the schedule (0-6, 0 = Sunday, or *).

edit_line POST mutating#

Edit a cron job

This function replaces an existing cron job's schedule and command.

JetHost note: the job's linekey CHANGES on edit — use the new linekey from the response, or call fetchcron again, before a further edit_line or remove_line. The same command rules as add_line apply (single line, \%, no MAILTO).

linekeystringRequired
The job's current linekey from fetchcron (or from the previous add_line / edit_line response).
commandstringRequired
The command to run. It must be a single line (cPanel rejects newlines). Escape a literal % as \% — crontab treats an unescaped % as a newline. Redirect output inside the command (e.g. >/dev/null 2>&1) to avoid cron mail; there is no MAILTO support.
minutestringRequired
The minute field of the schedule (0-59, , lists, ranges or steps such as /15).
hourstringRequired
The hour field of the schedule (0-23, *, lists, ranges or steps).
daystringRequired
The day-of-month field of the schedule (1-31 or *).
monthstringRequired
The month field of the schedule (1-12 or *).
weekdaystringRequired
The day-of-week field of the schedule (0-6, 0 = Sunday, or *).

fetchcron GET#

List cron jobs

This function returns the account's crontab as rows. Only rows with type command are jobs (linekey, minute, hour, day, month, weekday, command); rows with type variable are crontab variables such as MAILTO or SHELL.

JetHost note: linekey identifies a job for edit_line / remove_line and changes whenever the job is edited.

No parameters.

remove_line POST mutating#

Remove a cron job

This function removes a cron job from the account's crontab.

JetHost note: if the linekey came from an older listing it may be stale (every edit changes it); confirm the removal with fetchcron.

linekeystringRequired
The job's current linekey from fetchcron.