tcb fn trigger create
Creates timer triggers from the configuration in cloudbaserc.json.
Usage
# Triggers for a specific function
tcb fn trigger create <functionName>
# Triggers for every function in the configuration file
tcb fn trigger create
Flags
| Flag | Required | Description | Default |
|---|---|---|---|
[functionName] | No | Function name. Without it every function in the configuration file is processed | — |
-e, --env-id <envId> | No | Environment ID | Current default environment |
--yes | No | Skip the interactive confirmation | — |
Example
# Trigger for the app function
tcb fn trigger create app
# Triggers for every function
tcb fn trigger create
# Skip the confirmation in a script
tcb fn trigger create app -e envId --yes
Cron expressions
A Cron expression has seven required fields separated by spaces:
| Position | Field | Range | Wildcards |
|---|---|---|---|
| 1 | Second | 0–59 | , - * / |
| 2 | Minute | 0–59 | , - * / |
| 3 | Hour | 0–23 | , - * / |
| 4 | Day | 1–31 | , - * / |
| 5 | Month | 1–12 or JAN–DEC | , - * / |
| 6 | Weekday | 0–6 or MON–SUN, 0 is Sunday | , - * / |
| 7 | Year | 1970–2099 | , - * / |
Wildcards:
| Wildcard | Meaning | Example |
|---|---|---|
, | Union | 1,2,3 in the hour field means 1, 2, and 3 o'clock |
- | Range | 1-15 in the day field means the 1st to the 15th |
* | Every value | * in the hour field means every hour |
/ | Step | 1/10 in the minute field means every 10 minutes starting at minute 1 |
Common expressions:
*/5 * * * * * * Every 5 seconds
0 0 2 1 * * * At 02:00 on the 1st of every month
0 15 10 * * MON-FRI * 10:15 on weekdays
0 0 10,14,16 * * * * At 10:00, 14:00, and 16:00 every day
0 */30 9-17 * * * * Every half hour between 09:00 and 17:00
0 0 12 * * WED * At noon every Wednesday
Notes
- A function can currently have only one trigger
- The CLI reads trigger configuration from
cloudbaserc.json; creation fails when the file has no trigger configuration - When both day and weekday are set in the Cron expression, they are combined with OR
Related commands
- Delete triggers
- Function Configuration · Triggers: the
triggersfield