Deploying cron jobs
In this section, you'll learn how to set up a cron job using the Taskurai CLI.
Prerequisites
- A Taskurai installation (Taskurai instance, Taskurai CLI, ...). See Taskurai Setup.
Setup the configuration file
-
Navigate to the folder containing the taskurai.yaml configuration file.
-
Add a sample cron job to the configuration file
...
cronJobs:
AggregateDailySales:
description: Aggregate daily sales and upload to SAP
schedule: 0 0 2 * * *
timeZone: America/New_York
misfirePolicy: MostRecentCatchUp
category: Sales
taskConfig:
command: AggregateDailSalesSAP
arguments:
- name: region
value: USA
executionOptions:
notStartAfter:
seconds: 3600
...
Deploy cron job to Taskurai
Next, deploy the cron job to Taskurai using the CLI:
taskurai cronjob deploy
The number supported cron jobs is depending on your Taskurai plan.
Testing your setup
To verify that the cron job has been successfully deployed to Taskurai, use the following command:
taskurai cronjob show --name AggregateDailySales
When the deployment is successful, you should see output similar to the following:
# Signed into Taskurai
AggregateDailySales
├── General
│ └── ╭─────────────────────┬─────────────────────────────────────────╮
│ │ Setting │ Value │
│ ├─────────────────────┼─────────────────────────────────────────┤
│ │ Name │ AggregateDailySales │
│ │ Description │ Aggregate daily sales and upload to SAP │
│ │ Time Zone │ America/New_York │
│ │ Schedule │ 0 0 2 * * * │
│ │ Misfire Policy │ MostRecentCatchUp │
│ │ Category │ Sales │
│ │ External Id │ null │
│ │ External Account Id │ null │
│ │ External User Id │ null │
│ │ Unlisted │ null │
│ │ Isolation Mode │ null │
│ │ Isolation Key │ null │
│ │ Include Sensitive │ true │
│ ╰─────────────────────┴─────────────────────────────────────────╯
├── Tags
│ └── ╭─────────┬───────╮
│ │ Setting │ Value │
│ ╰─────────┴───────╯
└── Task Config
└── TaskConfig
├── General
│ └── ╭───────────────────────┬───────────────────────╮
│ │ Setting │ Value │
│ ├───────────────────────┼───────────────────────┤
│ │ Id │ null │
│ │ Idempotency Namespace │ null │
│ │ Idempotency Key │ null │
│ │ Command │ AggregateDailSalesSAP │
│ │ Category │ null │
│ │ Subject │ null │
│ │ Description │ null │
│ │ External Id │ null │
│ │ External Account Id │ null │
│ │ External User Id │ null │
│ │ Isolation Mode │ null │
│ │ Isolation Key │ null │
│ │ Unlisted │ null │
│ │ Correlation Id │ null │
│ │ Trace Parent │ null │
│ │ Parent Id │ null │
│ ╰───────────────────────┴───────────────────────╯
├── Arguments
│ └── ╭─────────────────┬────────┬──────┬────────────────┬───────────┬──────╮
│ │ SecretReference │ Name │ Type │ StateReference │ Sensitive │ data │
│ ├─────────────────┼────────┼──────┼────────────────┼───────────┼──────┤
│ │ null │ region │ null │ null │ null │ USA │
│ ╰─────────────────┴────────┴──────┴────────────────┴───────────┴──────╯
├── Secrets
│ └── ╭─────────╮
│ │ Secrets │
│ ╰─────────╯
├── Execution Options
│ └── ExecutionOptions
│ ├── General
│ │ └── ╭───────────────────────────────────┬───────╮
│ │ │ Setting │ Value │
│ │ ├───────────────────────────────────┼───────┤
│ │ │ Start After │ null │
│ │ │ Default Retry Policy │ null │
│ │ │ Timeout Retry Policy │ null │
│ │ │ Intermediate Failure Retry Policy │ null │
│ │ │ Failure Retry Policy │ null │
│ │ │ Max Duration │ null │
│ │ ╰───────────────────────────────────┴───────╯
│ └── Not Start After
│ └── ╭───────────┬───────╮
│ │ Setting │ Value │
│ ├───────────┼───────┤
│ │ Date Time │ null │
│ │ Seconds │ 3600 │
│ ╰───────────┴───────╯
└── Tags
└── ╭─────────┬───────╮
│ Setting │ Value │
╰─────────┴───────╯
That's it! You have successfully deployed a cron job to Taskurai.
Default scopes
Cron jobs created by the CLI assume administrator access. The tasks generated have these scopes by default:
Data/Buildby.Taskurai/sensitive/read: Can return sensitive data.Data/Buildby.Taskurai/secrets/read: Can read global secrets.
To override the sensitive behavior, it is possible to turn includeSensitive off in the cron job configuration.
More information
Read the section Cron job configuration to learn more about the configuration options.