Skip to content

Scheduled Task System

What Can the Scheduled Task System do?

  • Regularly updates subscriptions

  • Regularly updates rulesets

  • Regularly updates plugins

  • Regularly runs plugins

  • Regularly runs scripts

How the Scheduled Task Works

Dependencies for the Scheduled Task System: https://github.com/robfig/cron/tree/v3

  • Scheduled tasks use cron expression

  • Supports second-level precision, meaning the cron expression format is 6 fields, for example, * * * * * *, which runs every second.

Examples of Creating Scheduled Tasks

  1. Regularly update subscriptions

  1. Regularly update rulesets

  1. Regularly update plugins

  1. Regularly run plugins

The plugin requires an onTask action present

javascript
const onTask = () => {
  // 插件逻辑
  return "返回值会出现在日志中";
};

  1. Regularly run scripts

return can be written in the script. The returned value will show up in the logs

Scheduled Task Logs