Skip to content

Commit f644fc7

Browse files
committed
🤖 Update LLMs files [skip ci]
1 parent 5760b92 commit f644fc7

File tree

1 file changed

+0
-99
lines changed

1 file changed

+0
-99
lines changed

‎docusaurus/static/llms-full.txt‎

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -6559,105 +6559,6 @@ strapi.cron.jobs
65596559

65606560

65616561

6562-
# CRON jobs
6563-
Source: https://docs.strapi.io/cms/configurations/cron
6564-
6565-
# Cron jobs
6566-
6567-
:::prerequisites
6568-
The `cron.enabled` configuration option should be set to `true` in the `./config/server.js` (or `./config/server.ts` for TypeScript projects) [file](/cms/configurations/server).
6569-
:::
6570-
6571-
`cron` allows scheduling arbitrary functions for execution at specific dates, with optional recurrence rules. These functions are named cron jobs. `cron` only uses a single timer at any given time, rather than reevaluating upcoming jobs every second/minute.
6572-
6573-
This feature is powered by the
6574-
6575-
</Tabs>
6576-
6577-
<details>
6578-
<summary>Advanced example #1: Timezones</summary>
6579-
6580-
The following cron job runs on a specific timezone:
6581-
6582-
</Tabs>
6583-
6584-
</details>
6585-
6586-
<details>
6587-
<summary>Advanced example #2: One-off cron jobs</summary>
6588-
The following cron job is run only once at a given time:
6589-
6590-
</Tabs>
6591-
6592-
</details>
6593-
6594-
<details>
6595-
<summary>Advanced example #3: Start and end times</summary>
6596-
6597-
The following cron job uses start and end times:
6598-
6599-
</Tabs>
6600-
6601-
</details>
6602-
6603-
### Using the key format
6604-
6605-
:::warning
6606-
Using the key format creates an anonymous cron job which may cause issues when trying to disable the cron job or with some plugins. It is recommended to use the object format.
6607-
:::
6608-
6609-
To define a cron job with the key format, create a file with the following structure:
6610-
6611-
</Tabs>
6612-
6613-
## Enabling cron jobs
6614-
6615-
To enable cron jobs, set `cron.enabled` to `true` in the [server configuration file](/cms/configurations/server) and declare the jobs:
6616-
6617-
</Tabs>
6618-
6619-
## Adding or removing cron jobs
6620-
6621-
Use `strapi.cron.add` anywhere in your custom code add CRON jobs to the Strapi instance:
6622-
6623-
```js title="./src/plugins/my-plugin/strapi-server.js"
6624-
module.exports = () => ({
6625-
bootstrap({ strapi }) {
6626-
strapi.cron.add({
6627-
// runs every second
6628-
myJob: {
6629-
task: ({ strapi }) => {
6630-
console.log("hello from plugin");
6631-
},
6632-
options: {
6633-
rule: "* * * * * *",
6634-
},
6635-
},
6636-
});
6637-
},
6638-
});
6639-
```
6640-
6641-
Use `strapi.cron.remove` anywhere in your custom code to remove CRON jobs from the Strapi instance, passing in the key corresponding to the CRON job you want to remove:
6642-
6643-
```js
6644-
strapi.cron.remove("myJob");
6645-
```
6646-
6647-
:::note
6648-
Cron jobs that are using the [key as the rule](/cms/configurations/cron#using-the-key-format) can not be removed.
6649-
:::
6650-
6651-
## Listing cron jobs
6652-
6653-
Use `strapi.cron.jobs` anywhere in your custom code to list all the cron jobs that are currently running:
6654-
6655-
```js
6656-
strapi.cron.jobs
6657-
```
6658-
6659-
6660-
66616562
# Database configuration
66626563
Source: https://docs.strapi.io/cms/configurations/database
66636564

0 commit comments

Comments
 (0)