Skip to content

Commit

Permalink
sup-cmd: add an installable shell file for sup & some documentation (2…
Browse files Browse the repository at this point in the history
…600hz#1866)

* sup-cmd: add an installable shell file for sup & some documentation

* sup-cmd: add an anchor in doc

* sup-cmd: fix symlink creation
  • Loading branch information
fenollp authored and jamesaimonetti committed May 4, 2016
1 parent 2afd8f3 commit 565dd03
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
11 changes: 11 additions & 0 deletions core/sup/priv/sup
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# The file to copy/symlink under /usr/bin or similar

default_root="${KAZOO_ROOT:-_rel/kazoo}"
default_rel='bla@tld'

RELX_REPLACE_OS_VARS=true KZname="-name ${default_rel}" "${default_root}"/bin/kazoo escript lib/sup-*/priv/sup.escript "$*"

unset default_root
unset default_rel
22 changes: 22 additions & 0 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ $ make
* `make build-release` will generate a [deployable release](http://learnyousomeerlang.com/release-is-the-word)
* [More on using releases with Kazoo](https://github.com/2600Hz/kazoo/blob/master/doc/engineering/releases.md)
* `make sup_completion` creates `sup.bash`: a Bash completion file for the SUP command
* Copy or symlink this file to `/etc/bash_completion.d/sup.bash`

## SUP

The SUP command (`sup`) is found under `core/sup/priv/sup` and should be copied or symlinked
to `/usr/bin/sup`. It is a shell file that calls `sup.escript`.

```shell
ln -s core/sup/priv/sup /usr/bin/sup
```

Make sure that the path to Kazoo's intallation directory is right (in `/usr/bin/sup`).
Otherwise you can change it by setting the `KAZOO_ROOT` environment variable (not set by default).
If one needs `KAZOO_ROOT`, an alias should be created:

```shell
alias sup='KAZOO_ROOT=/opt/kazoo sup'
```

It is preferable but not required that one also adds autocompletion to the `sup` command.
In order to do this, see [documentation about `make sup_completion`](#longer-version).


# Bigger Picture

Expand Down
2 changes: 1 addition & 1 deletion scripts/conn-to-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [[ ! "$REMOTE_SHELL" == *@* ]]; then
REMOTE_SHELL="${REMOTE_SHELL}@$(hostname -f)"
fi

ERL_COOKIE=$(../utils/sup/sup erlang get_cookie | sed "s/'//g")
ERL_COOKIE=$(../core/sup/priv/sup erlang get_cookie | sed "s/'//g")

exec erl -setcookie $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL}

2 changes: 1 addition & 1 deletion scripts/crash-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd $(dirname $0)
NODE="kazoo_apps"
HOSTNAME=$(/bin/hostname)
REMOTE_SHELL="${NODE}@${HOSTNAME}"
SUP="../utils/sup/sup"
SUP=../core/sup/priv/sup

if [ -z "${1}" ]; then
ERL_COOKIE=$(${SUP} -n ${NODE} erlang get_cookie | sed "s/'//g")
Expand Down
6 changes: 3 additions & 3 deletions scripts/ecallmgr-process-count.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

cd $(dirname $0)

NODE="ecallmgr"
NODE=ecallmgr
HOSTNAME=$(/bin/hostname)
REMOTE_SHELL="${NODE}@${HOSTNAME}"
SUP="../utils/sup/sup"
SUP=../core/sup/priv/sup

if [ -z "${1}" ]; then
ERL_COOKIE=$(${SUP} -n ${NODE} erlang get_cookie | sed "s/'//g")
else
ERL_COOKIE="${1}"
ERL_COOKIE="${1}"
fi

echo $(erl_call -c ${ERL_COOKIE} -name ${REMOTE_SHELL} -a "erlang system_info ['process_count']")
3 changes: 1 addition & 2 deletions scripts/setup-dev.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

ln -s /opt/kazoo/utils/sup/sup /usr/bin/sup
ln -s /opt/kazoo/make/media_importer/media_importer /usr/bin/media_importer
ln -sf /opt/kazoo/core/priv/sup /usr/bin/sup
ln -s /opt/kazoo/scripts/rabbitmq-server.init /etc/init.d/rabbitmq-server
ln -s /opt/kazoo/scripts/kz-generic.init /etc/init.d/kz-ecallmgr
ln -s /opt/kazoo/scripts/kz-generic.init /etc/init.d/kz-kazoo_apps
Expand Down

0 comments on commit 565dd03

Please sign in to comment.