mist-cloud-eu.github.io

Cron jobs in mist-cloud

In order to run code at fixed intervals in mist-cloud we can use cron jobs. A mist cron job is a mechanism that can be configured to post custom events to the rapids at fixed times. For example, every 5 minutes (*/5 * * * *), or the last weekday of every month (0 0 L * *).

Although the complete syntax of cron expressions is out of the scope of this tutorial, our syntax of cron has 5-6 elements:

Example cron expressions:

To set up a cron job in mist-cloud simply use the command:

mist cron [name] --expr "[cron expression]" --event [event to post]

Using the 5 minute expression from above it cloud look like this:

mist cron hello --expr "*/5 * * * *"

Meaning, create a cron job called hello, that posts hello every 5 minutes.

⚠ Things to note:

You can delete a cron job by specifying an empty expression (""). And finally you can list your current cron jobs with the command:

mist list-crons