Skip to content

⏯️ Actions

To see available actions, run help or show actions.

Add -h to a command or preface with show help to learn more.

Custom actions

Use the @make_action decorator to make your scripts into custom actions.

Actions are commands for managing your Meerschaum instance and are a great way to perform bulk operations.

Syntax

Actions follow a simple verb-noun syntax (singular or plural):

1
2
3
4
5
6
7
bootstrap pipes
show pipes
sync pipes
verify pipes
clear pipes
drop pipes
delete pipes

Run mrsm (python -m meerschaum) to execute actions from the Meerschaum shell:

1
2
$ mrsm
[ mrsm@sql:main ]  show pipes

Or run actions directly from the command line:

1
$ mrsm show pipes

Chaining Actions

Join actions with + to run them in a single process (similar to && in bash):

1
2
sync pipes -i sql:local + \
sync pipes -i sql:main

Flags added after : apply to the entire pipeline:

1
2
3
4
show version + show arguments : --loop

sync pipes -c plugin:noaa + \
sync pipes -c sql:main : -s 'daily starting 00:00' -d

You can escape : with ::, e.g. mrsm echo :: will output :.

Here are some useful pipeline flags:

  • --loop
    Run the pipeline commands continuously.
  • --min-seconds (default 1)
    How many seconds to sleep between laps (if --loop or x3).
  • -s, --schedule, --cron
    Execute the pipeline on a schedule.
  • -d, --daemon
    Create a background job to run the pipeline.
  • x3, 3
    Execute the pipeline a specific number of times.

Note that you can add : to single commands as well:

1
mrsm show version : x3

Daemonize Actions

Add -d to any action to run it as a background job.

1
mrsm sync pipes -s 'every 3 hours' -d

This works well when chaining actions to create a pipeline job:

1
2
sync pipes -i sql:local + \
sync pipes -c sql:local : -s 'daily starting 10:00' -d

bash Actions

Any bash command may be run as an action. This is a great way to run shell scripts through Meerschaum.

1
mrsm /path/to/script.sh -s 'every 5 minutes' -d