The jobs
object in your jobs.config file is structured as follows:
1
Property | Type | Required |
---|---|---|
functionLocation | String | Yes |
functionName | String | Yes |
description | String | No |
executionConfig | Object | Yes |
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, .jsw or .web.js file.
functionName
Name of the function to run at the scheduled time.
Note: Make sure you export the function that you want the job scheduler to run.
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 will be triggered.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:
1
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
it creates an error 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:
1