Jobs: JSON Object

The jobs object in your jobs.config file is structured as follows:

Copy
1
PropertyTypeRequired
functionLocationStringYes
functionNameStringYes
descriptionStringNo
executionConfigObjectYes

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:

  • All times in job configurations are UTC time. To calculate the UTC equivalent of your local time, find your location's UTC time offset. Then either add or subtract to your local time based on the offset.
  • The job will run within 5 minutes after the specified time.
  • Jobs occurring more than once a day must be defined with a cron expression.
  • Most site plans only allow jobs to run at a minimum interval of 1 hour. If you need to add more jobs or run them more frequently, you can upgrade your site.
  • If both methods below are added to a single 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:

Copy
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:

Copy
1
Was this helpful?
Yes
No