Purpose
The ACS::TimerTrigger action can be used to perform O&M operations as scheduled. After an execution is started, CloudOps Orchestration Service (OOS) sets the state of the execution to Waiting until the specified point in time arrives. After the task is complete, the state of the execution changes to Waiting again.
Limits
The ACS::TimerTrigger action has the following limits:
You can use only one ACS::TimerTrigger action in a template.
The task in which the ACS::TimerTrigger action resides must be defined as the first task in the Tasks parameter of a template.
You are not allowed to use the ACS::TimerTrigger action in child templates.
Syntax
YAML format
Tasks:
- Name: timerTask # The name of the task.
Action: ACS::TimerTrigger
Properties:
Type: cron #Required. The type of the time. Valid values: rate, cron, and at.
Expression: '0 * * ? * *' # Required. The expression of the time, which is recorded in a cron, datetime, or rate expression. By default, time specified in a cron expression is calculated based on UTC.
TimeZone: 'Asia/Shanghai' # Optional. The time zone of the selected time. Default value: UTC.
EndDate: '2020-12-29T09:19:30Z' # Required. The end time in the YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format. The time must be in 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-12-29T09:19:30Z",
"TimeZone": "Asia/Shanghai"
}
}
]
}Flowchart
Description:
After you create an execution, the state of the parent execution changes to Waiting.
When the specified point in time arrives, the state of the parent execution changes to Running. At the same time, the parent execution automatically creates a child execution. The child execution uses the same template and parameters as the parent execution, but skips the trigger action to directly perform the subsequent tasks.
After the child execution is complete and its state changes to a final state, such as Success, Failed, or Cancelled, the state of the parent execution changes to Waiting again. When the next specified point in time arrives, the parent execution repeats the previous steps until the specified end time arrives.
When the end time arrives, the parent execution is complete. The state of the parent execution changes from Waiting to Success.
You can cancel a parent or child execution like canceling a common execution. The state of a canceled execution changes to Cancelled.
Examples
cron type
YAML format
FormatVersion: OOS-2019-06-01
Description: Schedule to reboot ECS instances.
Tasks:
- Name: timer
Action: ACS::TimerTrigger
Properties:
Type: cron
Expression: "0 * * ? * *"
EndDate: 2020-12-20T00:00:00Z
- Name: rebootInstance
Action: ACS::ECS::RebootInstance
Properties:
InstanceId: "i-xxxxx"JSON format
{
"FormatVersion": "OOS-2019-06-01",
"Description": "Schedule to reboot ECS instances.",
"Tasks": [
{
"Name": "timer",
"Action": "ACS::TimerTrigger",
"Properties": {
"Type": "cron",
"Expression": "0 * * ? * *",
"EndDate": "2020-12-20 00:00:00 UTC"
}
},
{
"Name": "rebootInstance",
"Action": "ACS::ECS::RebootInstance",
"Properties": {
"InstanceId": "i-xxxxx"
}
}
]
}at type
YAML format
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"JSON format
{
"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"
}
}
]
}