Skip to main content

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​

FlagRequiredDescriptionDefault
[functionName]NoFunction name. Without it every function in the configuration file is processed—
-e, --env-id <envId>NoEnvironment IDCurrent default environment
--yesNoSkip 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:

PositionFieldRangeWildcards
1Second0–59, - * /
2Minute0–59, - * /
3Hour0–23, - * /
4Day1–31, - * /
5Month1–12 or JAN–DEC, - * /
6Weekday0–6 or MON–SUN, 0 is Sunday, - * /
7Year1970–2099, - * /

Wildcards:

WildcardMeaningExample
,Union1,2,3 in the hour field means 1, 2, and 3 o'clock
-Range1-15 in the day field means the 1st to the 15th
*Every value* in the hour field means every hour
/Step1/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