From 3188941af20c020df756e82393649b561d46c984 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Wed, 20 May 2015 14:06:03 +0200 Subject: [PATCH] Add minor robustness on cluster scripts --- tools/joincluster | 6 +++--- tools/leavecluster | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/joincluster b/tools/joincluster index b3516d94d..ff2e0380f 100755 --- a/tools/joincluster +++ b/tools/joincluster @@ -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 diff --git a/tools/leavecluster b/tools/leavecluster index 7acc2b46c..edac8689e 100755 --- a/tools/leavecluster +++ b/tools/leavecluster @@ -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