crons
Creates, updates, deletes, gets or lists a crons resource.
Overview​
| Name | crons |
| Type | Resource |
| Id | ovh.hosting_web.crons |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | integer | Cron's id |
command | string | Command to execute |
description | string | Description field for you |
email | string | Email used to receive error log (stderr) |
frequency | string | Frequency (crontab format) defined for the script (minutes are ignored) |
language | string | Cron language (node10, node11, node12, node14, node8, node9, other, php4, php5.2, php5.3, php5.4, php5.5, php5.6, php7.0, php7.1, php7.2, php7.3, php7.4, php8.0, php8.1, php8.2, php8.3, php8.4, php8.5, python2, python3, ruby2.6) |
state | string | Cron language (created, creating, deleting, updating) |
status | string | Cron status (disabled, enabled, suspended) |
Cron
| Name | Datatype | Description |
|---|---|---|
id | integer | Cron's id |
command | string | Command to execute |
description | string | Description field for you |
email | string | Email used to receive error log (stderr) |
frequency | string | Frequency (crontab format) defined for the script (minutes are ignored) |
language | string | Cron language (node10, node11, node12, node14, node8, node9, other, php4, php5.2, php5.3, php5.4, php5.5, php5.6, php7.0, php7.1, php7.2, php7.3, php7.4, php8.0, php8.1, php8.2, php8.3, php8.4, php8.5, python2, python3, ruby2.6) |
state | string | Cron language (created, creating, deleting, updating) |
status | string | Cron status (disabled, enabled, suspended) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id, service_name | Returns the command, frequency, language, email and status of the cron job. | |
list | select | service_name | command, description, email, language, x_pagination_mode | Returns the IDs of the cron jobs of the hosting. Filter them by command, description, email or language. |
create | insert | service_name, command, frequency, language | Creates a cron job that runs a script at a crontab frequency, and returns the task. Minutes in the frequency are ignored. Errors are sent to the email address. | |
update | update | id, service_name, command, frequency, language | Updates the command, frequency, language, email or description of the cron job. Minutes in the frequency are ignored. | |
delete | delete | id, service_name | Deletes the cron job and returns the task. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
id | integer | Id |
service_name | string | Service name (wire: serviceName) |
command | string | Filter the value of command property (like) |
description | string | Filter the value of description property (like) |
email | string | Filter the value of email property (like) |
language | string | Filter the value of language property (=) |
x_pagination_mode | string | Sent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode) |
SELECT examples​
- get
- list
Returns the command, frequency, language, email and status of the cron job.
SELECT
id,
command,
description,
email,
frequency,
language,
state,
status
FROM ovh.hosting_web.crons
WHERE id = '{{ id }}' -- required
AND service_name = '{{ service_name }}' -- required
;
Returns the IDs of the cron jobs of the hosting. Filter them by command, description, email or language.
SELECT
id,
command,
description,
email,
frequency,
language,
state,
status
FROM ovh.hosting_web.crons
WHERE service_name = '{{ service_name }}' -- required
AND command = '{{ command }}'
AND description = '{{ description }}'
AND email = '{{ email }}'
AND language = '{{ language }}'
AND x_pagination_mode = '{{ x_pagination_mode }}'
;
INSERT examples​
- create
- Manifest
Creates a cron job that runs a script at a crontab frequency, and returns the task. Minutes in the frequency are ignored. Errors are sent to the email address.
INSERT INTO ovh.hosting_web.crons (
command,
description,
email,
frequency,
language,
status,
service_name
)
SELECT
'{{ command }}' /* required */,
'{{ description }}',
'{{ email }}',
'{{ frequency }}' /* required */,
'{{ language }}' /* required */,
'{{ status }}',
'{{ service_name }}'
RETURNING
id,
object_id,
done_date,
function,
last_update,
object_type,
start_date,
status
;
# Description fields are for documentation purposes
- name: crons
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the crons resource.
- name: command
value: "{{ command }}"
description: |
Command to execute
- name: description
value: "{{ description }}"
description: |
Description field for you
- name: email
value: "{{ email }}"
description: |
Email used to receive error log (stderr)
- name: frequency
value: "{{ frequency }}"
description: |
Frequency (crontab format) defined for the script (minutes are ignored)
- name: language
value: "{{ language }}"
description: |
Cron language
valid_values: ['node10', 'node11', 'node12', 'node14', 'node8', 'node9', 'other', 'php4', 'php5.2', 'php5.3', 'php5.4', 'php5.5', 'php5.6', 'php7.0', 'php7.1', 'php7.2', 'php7.3', 'php7.4', 'php8.0', 'php8.1', 'php8.2', 'php8.3', 'php8.4', 'php8.5', 'python2', 'python3', 'ruby2.6']
- name: status
value: "{{ status }}"
description: |
Cron status
valid_values: ['disabled', 'enabled', 'suspended']
UPDATE examples​
- update
Updates the command, frequency, language, email or description of the cron job. Minutes in the frequency are ignored.
UPDATE ovh.hosting_web.crons
SET
command = '{{ command }}',
description = '{{ description }}',
email = '{{ email }}',
frequency = '{{ frequency }}',
language = '{{ language }}',
status = '{{ status }}'
WHERE
id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required
AND command = '{{ command }}' --required
AND frequency = '{{ frequency }}' --required
AND language = '{{ language }}' --required;
DELETE examples​
- delete
Deletes the cron job and returns the task.
DELETE FROM ovh.hosting_web.crons
WHERE id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required
;