Schedule

View source code

View [code example](#code example)

Yao's scheduled task is a Widget function. Using the task scheduling function, any DSL script and Flows can be scheduled to run at a most convenient time. The task scheduler starts and runs in the background every time the system starts. When we need to execute some repetitive events on the server regularly, we can run the prepared DSL script through the task scheduler to run at a specific time.

Naming conventions

{
"name": "Description of Scheduled Task",
"schedule": "Scheduled task time setting",
"process": "Specified process",
"args": []
}

DSL structure

FieldDescription
namename
scheduleScheduled task time settings
processspecified process

code example

Step 1: Create a new scheduled task

  • Create a new /schedules/test.sch.json, the writing method of the scheduled task is the same as the Linux crontab, the code:
{
"name": "Called every minute",
"schedule": "*/1 * * * *",
"process": "scripts.schedules.Send",
"args": []
}

Step 2: Create processing logic

  • New scripts/schedules.js code:
function Send() {
console.log("Enter the scheduled task!");
}

Execute yao start and wait for 1 minute to see the print information

Schedule

View source code

View [code example](#code example)

Yao's scheduled task is a Widget function. Using the task scheduling function, any DSL script and Flows can be scheduled to run at a most convenient time. The task scheduler starts and runs in the background every time the system starts. When we need to execute some repetitive events on the server regularly, we can run the prepared DSL script through the task scheduler to run at a specific time.

Naming conventions

{
"name": "Description of Scheduled Task",
"schedule": "Scheduled task time setting",
"process": "Specified process",
"args": []
}

DSL structure

FieldDescription
namename
scheduleScheduled task time settings
processspecified process

code example

Step 1: Create a new scheduled task

  • Create a new /schedules/test.sch.json, the writing method of the scheduled task is the same as the Linux crontab, the code:
{
"name": "Called every minute",
"schedule": "*/1 * * * *",
"process": "scripts.schedules.Send",
"args": []
}

Step 2: Create processing logic

  • New scripts/schedules.js code:
function Send() {
console.log("Enter the scheduled task!");
}

Execute yao start and wait for 1 minute to see the print information