Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickaël Rémond <mremond@process-one.net>2015-01-29 20:43:47 +0300
committerMickaël Rémond <mremond@process-one.net>2015-02-10 19:56:44 +0300
commit01e1f677c72b923251f7021bc024319ff129d42d (patch)
tree38c3101d86f42b62774df909193cdfe6be69614c /ejabberdctl.template
parentcf929e730faba7a34926a9ce6f7b9c5701bbe23e (diff)
Add Elixir support to ejabberd
Diffstat (limited to 'ejabberdctl.template')
-rwxr-xr-xejabberdctl.template105
1 files changed, 75 insertions, 30 deletions
diff --git a/ejabberdctl.template b/ejabberdctl.template
index 4e8234c99..2025fd22d 100755
--- a/ejabberdctl.template
+++ b/ejabberdctl.template
@@ -12,6 +12,7 @@ ERLANG_NODE=ejabberd@localhost
# define default environment variables
SCRIPT_DIR=`cd ${0%/*} && pwd`
ERL={{erl}}
+IEX={{bindir}}/iex
INSTALLUSER={{installuser}}
# Compatibility in ZSH
@@ -128,6 +129,7 @@ if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
else
NAME="-name"
fi
+IEXNAME="-$NAME"
# define ejabberd environment parameters
if [ "$EJABBERD_CONFIG_PATH" != "${EJABBERD_CONFIG_PATH%.yml}" ] ; then
@@ -183,6 +185,67 @@ start()
# attach to server
debug()
{
+ debugwarning
+ TTY=`tty | sed -e 's/.*\///g'`
+ $EXEC_CMD "$ERL \
+ $NAME debug-${TTY}-${ERLANG_NODE} \
+ -remsh $ERLANG_NODE \
+ -hidden \
+ $KERNEL_OPTS \
+ $ERLANG_OPTS $ARGS \"$@\""
+}
+
+# attach to server using Elixir
+iexdebug()
+{
+ debugwarning
+ TTY=`tty | sed -e 's/.*\///g'`
+ # Elixir shell is hidden as default
+ $EXEC_CMD "$IEX \
+ $IEXNAME debug-${TTY}-${ERLANG_NODE} \
+ --remsh $ERLANG_NODE \
+ --erl \"$KERNEL_OPTS\" \
+ --erl \"$ERLANG_OPTS\" --erl \"$ARGS\" --erl \"$@\""
+}
+
+# start interactive server
+live()
+{
+ livewarning
+ $EXEC_CMD "$ERL \
+ $NAME $ERLANG_NODE \
+ -pa $EJABBERD_EBIN_PATH \
+ -mnesia dir \"\\\"$SPOOL_DIR\\\"\" \
+ $KERNEL_OPTS \
+ $EJABBERD_OPTS \
+ -s ejabberd \
+ $ERLANG_OPTS $ARGS \"$@\""
+}
+
+# start interactive server with Elixir
+iexlive()
+{
+ livewarning
+ $EXEC_CMD "$IEX \
+ $IEXNAME $ERLANG_NODE \
+ -pa $EJABBERD_EBIN_PATH \
+ --erl \"-mnesia dir \\\"$SPOOL_DIR\\\"\" \
+ --erl \"$KERNEL_OPTS\" \
+ --erl \"$EJABBERD_OPTS\" \
+ --app ejabberd \
+ --erl \"$ERLANG_OPTS\" --erl $ARGS --erl \"$@\""
+}
+
+etop()
+{
+ $EXEC_CMD "$ERL \
+ $NAME debug-${TTY}-${ERLANG_NODE} \
+ -hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
+}
+
+# TODO: refactor debug warning and livewarning
+debugwarning()
+{
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
echo "--------------------------------------------------------------------"
echo ""
@@ -199,21 +262,13 @@ debug()
echo "--------------------------------------------------------------------"
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
echo " EJABBERD_BYPASS_WARNINGS=true"
- echo "Press any key to continue"
+ echo "Press return to continue"
read foo
echo ""
- fi
- TTY=`tty | sed -e 's/.*\///g'`
- $EXEC_CMD "$ERL \
- $NAME debug-${TTY}-${ERLANG_NODE} \
- -remsh $ERLANG_NODE \
- -hidden \
- $KERNEL_OPTS \
- $ERLANG_OPTS $ARGS \"$@\""
+ fi
}
-# start interactive server
-live()
+livewarning()
{
check_start
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
@@ -231,34 +286,22 @@ live()
echo "--------------------------------------------------------------------"
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
echo " EJABBERD_BYPASS_WARNINGS=true"
- echo "Press any key to continue"
+ echo "Press return to continue"
read foo
echo ""
fi
- $EXEC_CMD "$ERL \
- $NAME $ERLANG_NODE \
- -pa $EJABBERD_EBIN_PATH \
- -mnesia dir \"\\\"$SPOOL_DIR\\\"\" \
- $KERNEL_OPTS \
- $EJABBERD_OPTS \
- -s ejabberd \
- $ERLANG_OPTS $ARGS \"$@\""
-}
-
-etop()
-{
- $EXEC_CMD "$ERL \
- $NAME debug-${TTY}-${ERLANG_NODE} \
- -hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
}
+# TODO: Make iex command display only if ejabberd Elixir support has been enabled
help()
{
echo ""
echo "Commands to start an ejabberd node:"
- echo " start Start an ejabberd node in server mode"
- echo " debug Attach an interactive Erlang shell to a running ejabberd node"
- echo " live Start an ejabberd node in live (interactive) mode"
+ echo " start Start an ejabberd node in server mode"
+ echo " debug Attach an interactive Erlang shell to a running ejabberd node"
+ echo " iexdebug Attach an interactive Elixir shell to a running ejabberd node"
+ echo " live Start an ejabberd node in live (interactive) mode"
+ echo " iexlive Start an ejabberd node in live (interactive) mode, within an Elixir shell"
echo ""
echo "Optional parameters when starting an ejabberd node:"
echo " --config-dir dir Config ejabberd: $ETC_DIR"
@@ -409,7 +452,9 @@ wait_for_status()
case $ARGS in
' start') start;;
' debug') debug;;
+ ' iexdebug') iexdebug;;
' live') live;;
+ ' iexlive') iexlive;;
' etop') etop;;
' started') wait_for_status 0 30 2;; # wait 30x2s before timeout
' stopped') wait_for_status 3 15 2 && stop_epmd;; # wait 15x2s before timeout