mirror of
https://github.com/strapi/strapi.git
synced 2025-07-21 16:10:18 +00:00
741 B
Executable File
741 B
Executable File
Scheduled tasks
CRON tasks allow you to schedule jobs (arbitrary functions) for execution at specific dates, with optional recurrence rules. It only uses a single timer at any given time (rather than reevaluating upcoming jobs every second/minute).
Configuration and usage
Configuration:
- Key:
cron
- Environment: all
- Location:
./config/functions/cron.js
- Type:
object
Example:
module.exports.cron = {
/**
* Every day at midnight.
*/
'0 0 * * *': function () {
strapi.log.info('Midnight !');
}
};
Notes:
- The cron format consists of:
- second (0 - 59, optional)
- minute (0 - 59)
- hour (0 - 23)
- day of month (1 - 31)
- month (1 - 12)
- day of week (0 - 7)