From f40ffd8028d3dd4f3eef4a3409c531af941d23f0 Mon Sep 17 00:00:00 2001 From: M S Vishwanath Bhat Date: Thu, 12 Jan 2012 23:30:00 +0530 Subject: renaming helper_scrips->helper_scripts and cleaning up the whitespaces Change-Id: I6004e4066fab30e14716ef6475c1281270974d2b Signed-off-by: M S Vishwanath Bhat --- helper_scripts/probe.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 helper_scripts/probe.sh (limited to 'helper_scripts/probe.sh') diff --git a/helper_scripts/probe.sh b/helper_scripts/probe.sh new file mode 100755 index 0000000..f6fc217 --- /dev/null +++ b/helper_scripts/probe.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +function _init () +{ + set -u; +} + +function peer_probe () +{ + local remote_server=; + + if [ $# -eq 1 ]; then + remote_server=$1; + fi + + if [ $remote_server ]; then + gluster peer probe $remote_server; + return 0; + fi + + for i in $(cat /root/servers) + do + peer_probe $i; + done + +} + +function main () +{ + stat --printf=%i /root/servers 2>/dev/null 1>/dev/null; + if [ $? -ne 0 ]; then + echo "servers file is not present /root. Cannot execute further." + exit 1 + fi + + peer_probe; + + return 0; +} + +_init && main "$@" -- cgit