summaryrefslogtreecommitdiffstats
path: root/helper_scrips/detach.sh
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2011-12-22 12:06:45 +0530
committerRaghavendra Bhat <raghavendrabhat@gluster.com>2011-12-22 12:06:45 +0530
commitf9d7be7082ea972dac7912eff6ca8ff4000cd24a (patch)
treef6f976ab475bb22af568187eec0801dbf715ffee /helper_scrips/detach.sh
parent020c2d441e83e616010b921bd266086ed387afa7 (diff)
helper_scripts: changes in probe script abd detach script is added
Some minor changes in the probe script (change in the function names) and detach script is added to detach the peers in the cluster. Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Diffstat (limited to 'helper_scrips/detach.sh')
-rwxr-xr-xhelper_scrips/detach.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/helper_scrips/detach.sh b/helper_scrips/detach.sh
new file mode 100755
index 0000000..8ccca53
--- /dev/null
+++ b/helper_scrips/detach.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+function _init ()
+{
+ set -u;
+}
+
+function peer_detach ()
+{
+ local remote_server=;
+
+ if [ $# -eq 1 ]; then
+ remote_server=$1;
+ fi
+
+ if [ $remote_server ]; then
+ gluster peer detach $remote_server;
+ return 0;
+ fi
+
+ for i in $(cat /root/servers)
+ do
+ peer_detach $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_detach;
+
+ return 0;
+}
+
+_init && main "$@"