diff --git a/README.md b/README.md index 692f1c3..6504bb3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ When preparing your runtime, this engine compiles code by doing the following: This engine provides helper scripts to make managing your Elixir application easier. ### node-attach -The `node-attach` helper facilitates connecting to an Elixir node that was started with `elixir-start`. +The `node-attach` helper facilitates connecting to an Elixir node that was started with `node-start`. ```bash node-attach @@ -40,6 +40,13 @@ node-start mix phoenix.server node-start mix run —no-halt ``` +### node-stop +The `node-stop` helper ensures that an Elixir node started with `node-start` is stopped gracefully. + +```bash +node-stop +``` + ## Configuration Options This engine exposes configuration options through the [boxfile.yml](http://docs.nanobox.io/boxfile/), a yaml config file used to provision and configure your app's infrastructure when using Nanobox. This engine makes the following options available. diff --git a/files/bin/node-attach b/files/bin/node-attach index 403a349..0b9fa3d 100755 --- a/files/bin/node-attach +++ b/files/bin/node-attach @@ -1,11 +1,11 @@ #!/bin/bash -# +# # A simple wrapper to facilitate connecting to an elixir -# node that was started with `elixir-start` -# +# node that was started with `node-start` +# # Usage: # node-attach -# +# # exit if any any command fails set -e diff --git a/files/bin/node-stop b/files/bin/node-stop new file mode 100644 index 0000000..21ab04b --- /dev/null +++ b/files/bin/node-stop @@ -0,0 +1,21 @@ +#!/bin/bash +# +# A simple wrapper to facilitate stopping an elixir node that was +# started with `node-start` +# +# Usage: +# node-stop +# + +# exit if any any command fails +set -e + +# establish the name and cookie (if available) +name="stop@$(hostname -i)" +cookie="${COOKIE:-nanobox}" +remote="${HOSTNAME//./-}@$(hostname -i)" + +elixir \ + --name $name \ + --cookie $cookie \ + -e ":rpc.call(:\"$remote\", :init, :stop, [])"