When scheduling recurring jobs on your site, you define the jobs in the jobs.config
file. The jobs
object in the file is structured as follows:
Property | Type | Required |
---|---|---|
functionLocation | String | Yes |
functionName | String | Yes |
description | String | No |
executionConfig | Object | Yes |
Here is an example of a JSON object configured to send a status report every Monday morning at 8:00 AM UTC time:
functionLocation
Path to the backend file that contains the function you want to run at the scheduled time. The function location is a relative path within the Backend folder. The function can be in any backend .js
, .web.js
, or .jsw
file.
functionName
Name of the function to run at the scheduled time.
Note: Make sure that you export the function you want the job scheduler to run on.
description
Optional description of the job.
executionConfig
Object that contains information about when the job should run, using either a cron expression or time configuration properties.
Notes:
executionConfig
object, only the cron expression is used.cronExpression
Use a cron expression as a single property in the executionConfig
object.
For example, to run a job every day at 8:00 in the morning, use:
time
, dayOfWeek
, dateOfMonth
Use multiple properties, time
, dayOfWeek
, dateOfMonth
, to schedule the job. time
is the only required property with this method.
If a job includes both dayOfWeek
and dateOfMonth
, an error occurs and the job will not run.
time
The time of day the job runs. The time is specified as UTC time in HH:MM
format.dayOfWeek
One of: Sunday
, Monday
, Tuesday
, Wednesday
, Thursday
, Friday
, or Saturday
dateInMonth
Number between 1
and 31
.For example, to run a job every Sunday at 8:00 in the morning, use: