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
AM UTC time:functionLocationPath 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.
functionNameName 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.
descriptionOptional description of the job.
executionConfigObject 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.cronExpressionUse a cron expression as a single property in the executionConfig object.
For example, to run a job every day at 8
in the morning, use:time, dayOfWeek, dateOfMonthUse 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 SaturdaydateInMonth Number between 1 and 31.For example, to run a job every Sunday at 8
in the morning, use: