Features
The ACS::TimerTrigger action can be used to perform O&M operations at scheduled time points. After an execution is started, CloudOps Orchestration Service (OOS) sets the execution to the Waiting status until the specified time point arrives. After the task is completed, the execution enters the Waiting status again.
Restrictions
The trigger actions have the following restrictions:
Only one trigger action is allowed for one template.
The trigger action must be defined as the first action.
The trigger action is not allowed for an embedded template.
Syntax
YAML format
Tasks:
- Name: timerTask # The name of the task.
Action: ACS::TimerTrigger
Properties:
Type: cron # Required. The type of the time, which is recorded in a cron or rate expression. rate or cron or at type is optional.
Expression: '0 * * ? * *' # Required. The expression of the time, which is recorded in a cron or datetime or rate expression.
TimeZone: 'Asia/Shanghai'
EndDate: 2020-06-01T00:00:00Z # Required. The end time in the YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format. The time must be in Coordinated Universal Time (UTC).
JSON format (For more information, see the parameter description for the YAML format.)
{
"Tasks": [
{
"Name": "timerTask",
"Action": "ACS::TimerTrigger",
"Properties": {
"Type": "cron",
"Expression": "0 * * ? * *",
"EndDate": "2020-06-01T00:00:00.000Z",
"TimeZone": "Asia/Shanghai"
}
}
]
}
Flow chart
Description
After you create an execution, the parent execution enters the Waiting status.
When the specified time point arrives, the parent execution enters the Running status. At the same time, the parent execution automatically creates a child execution. The child execution uses the same template and parameters, but skips the trigger action to directly perform the subsequent tasks.
After the child execution enters a final status, such as Success, Failed, or Cancelled, the parent execution enters the Waiting status again. When the next specified time point arrives, the parent execution repeats the previous steps until the specified end time arrives.
When the end time arrives, the parent execution is completed. The status of the parent execution changes from Waiting to Success.
You can cancel a parent or child execution like canceling a common execution. A canceled execution enters the Cancelled status.
Example
The following template is used to start a specified instance at a specified time point:
cron type:
FormatVersion: OOS-2019-06-01
Description: Schedule to reboot ECS instances.
Tasks:
- Name: timer
Action: ACS::TimerTrigger
Properties:
Type: cron
Expression: 5 minute
EndDate: 2020-12-20T00:00:00Z
- Name: rebootInstance
Action: ACS::ECS::RebootInstance
Properties:
InstanceId: "i-xxxxx"
{
"FormatVersion": "OOS-2019-06-01",
"Description": "Schedule to reboot ECS instances.",
"Tasks": [
{
"Name": "timer",
"Action": "ACS::TimerTrigger",
"Properties": {
"Type": "cron",
"Expression": "5 minute",
"EndDate": "2020-12-20 00:00:00 UTC"
}
},
{
"Name": "rebootInstance",
"Action": "ACS::ECS::RebootInstance",
"Properties": {
"InstanceId": "i-xxxxx"
}
}
]
}
at type:
FormatVersion: OOS-2019-06-01
Description: Schedule to reboot ECS instances.
Tasks:
- Name: timer
Action: ACS::TimerTrigger
Properties:
Type: at
Expression: '2020-02-29T09:17:35Z'
EndDate: 2020-12-20T00:00:00Z
- Name: rebootInstance
Action: ACS::ECS::RebootInstance
Properties:
InstanceId: "i-xxxxx"
{
"FormatVersion": "OOS-2019-06-01",
"Description": "Schedule to reboot ECS instances.",
"Tasks": [
{
"Name": "timer",
"Action": "ACS::TimerTrigger",
"Properties": {
"Type": "at",
"Expression": "2020-02-29T09:17:35Z",
"EndDate": "2020-12-20T00:00:00.000Z"
}
},
{
"Name": "rebootInstance",
"Action": "ACS::ECS::RebootInstance",
"Properties": {
"InstanceId": "i-xxxxx"
}
}
]
}