]> granicus.if.org Git - ejabberd/commitdiff
Add minor robustness on cluster scripts
authorChristophe Romain <christophe.romain@process-one.net>
Wed, 20 May 2015 12:06:03 +0000 (14:06 +0200)
committerChristophe Romain <christophe.romain@process-one.net>
Wed, 20 May 2015 12:06:03 +0000 (14:06 +0200)
tools/joincluster
tools/leavecluster

index b3516d94df86f70a44f983ab87355e6ff800b98f..ff2e0380f512cdf5e5246048a263ca690cc576cd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 # Add the current ejabberd node in a cluster
 
@@ -56,7 +56,7 @@ function error
 
 PA=/tmp/clustersetup_$$
 CTL=$(which ejabberdctl)
-[ "$CTL" == "" ] && {
+[ -x "$CTL" ] || {
   HERE=`which "$0"`
   BASE=`dirname $HERE`/..
   ROOTDIR=`cd $BASE; pwd`
@@ -65,7 +65,7 @@ CTL=$(which ejabberdctl)
   CTL=$(which ejabberdctl)
 }
 echo "Using commands:"
-[ -x $CTL ] && echo $CTL || error "can't find ejabberdctl" 10
+[ -x "$CTL" ] && echo $CTL || error "can't find ejabberdctl" 10
 
 . $CTL stop 2>/dev/null >/dev/null
 ERLC=${ERL}c
index 7acc2b46ce8c967a9ddbfd972f44e737c2de34e5..edac8689eb27011e5540870cfc787f5dcd37340b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 # Remove the current ejabberd node in a cluster
 
@@ -36,7 +36,7 @@ exit
 
 PA=/tmp/clustersetup_$$
 CTL=$(which ejabberdctl)
-[ "$CTL" == "" ] && {
+[ -x "$CTL" ] || {
   HERE=`which "$0"`
   BASE=`dirname $HERE`/..
   ROOTDIR=`cd $BASE; pwd`
@@ -45,7 +45,7 @@ CTL=$(which ejabberdctl)
   CTL=$(which ejabberdctl)
 }
 echo "Using commands:"
-[ -x $CTL ] && echo $CTL || error "can't find ejabberdctl" 10
+[ -x "$CTL" ] && echo $CTL || error "can't find ejabberdctl" 10
 
 . $CTL stop 2>/dev/null >/dev/null
 ERLC=${ERL}c