Browse files

new utils module for starting/stopping the server

  • Loading branch information...
1 parent 6169ca4 commit 13cda19c69ec49e2ca786ab46f485ee17ecac339 @videlalvaro committed May 7, 2011
Showing with 21 additions and 1 deletion.
  1. +4 −0 sbin/rmqchat.sh
  2. +2 −1 src/rabbitmq_chat.app.src
  3. +15 −0 src/rmqchat_utils.erl
View
4 sbin/rmqchat.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+cd `dirname $0`
+exec erl -sname rmqchat_admin -pa $PWD/../ebin #\
+#-s rmqchat_utils stop $1 $2 -noshell -s init stop
View
3 src/rabbitmq_chat.app.src
@@ -7,7 +7,8 @@
rabbitmq_chat_app,
rabbitmq_chat_consumer,
rabbitmq_chat_rest,
- rabbitmq_chat_sup
+ rabbitmq_chat_sup,
+ rmqchat_utils.erl
]},
{registered, []},
{applications, [
View
15 src/rmqchat_utils.erl
@@ -0,0 +1,15 @@
+-module(rmqchat_utils).
+
+-export([start/1, stop/1, halt_node/1]).
+
+start([Node, App]) ->
+ pong = net_adm:ping(Node),
+ rpc:call(Node, application, start, [App]).
+
+stop([Node, App]) ->
+ pong = net_adm:ping(Node),
+ rpc:call(Node, application, stop, [App]).
+
+halt_node([Node]) ->
+ pong = net_adm:ping(Node),
+ rpc:call(Node, init, stop, []).

0 comments on commit 13cda19

Please sign in to comment.