Oracle-Sentry/docs/cn/script/groovy/可用的触发器.md

37 lines
573 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 可用的触发器
### Once 触发器
Once 触发器只会在启动后执行一次,适用于初始化等操作。
示例:
```groovy
trigger ("once") {
run {
// do something...
}
}
```
参数:
- (没有参数)
`it` 对象:无
### Timer 触发器
Timer 触发器通过设定的 Cron 时间表达式,根据时间触发执行,可用于定时检查等操作。
示例:
```groovy
trigger ("once") {
time "0 0 12 * * ? *"
run {
// do something...
}
}
```
参数:
- `time`Cron 时间表达式
`it` 对象:无