Custom Commands

Custom commands are extensions to the boot script, and are used in the same way you use foreground or remote_console, in other words, they have the appearance of being part of the boot script. Like hooks, they have access to the boot scripts helper functions and environment.

Example Usage

Given a config like the following:

use Mix.Releases.Config

environment :default do
  set commands: [
    echo: "rel/commands/echo"

release :myapp do
  set version: current_version(:myapp)

And the command script under rel/commands/echo:

echo "$2"

When you build your release, you can then call your command like so:

> _build/dev/rel/myapp/bin/myapp echo hi

You have access to anything defined in the boot script’s environment, see Shell Script API for details.