diff options
-rwxr-xr-x | helper_scrips/detach.sh | 41 | ||||
-rwxr-xr-x | helper_scrips/probe.sh | 8 |
2 files changed, 44 insertions, 5 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 "$@" diff --git a/helper_scrips/probe.sh b/helper_scrips/probe.sh index b804c7f..f6fc217 100755 --- a/helper_scrips/probe.sh +++ b/helper_scrips/probe.sh @@ -5,7 +5,7 @@ function _init () set -u; } -function clean_logs () +function peer_probe () { local remote_server=; @@ -20,7 +20,7 @@ function clean_logs () for i in $(cat /root/servers) do - clean_logs $i; + peer_probe $i; done } @@ -33,11 +33,9 @@ function main () exit 1 fi - clean_logs; + peer_probe; return 0; } _init && main "$@" - - |