clustall

0 Likes
Bash script to put Online/Offline or Migrate all resources of a cluster at once.

It is not fully idiot proof but it work great
#!/bin/sh
#
# Nicolas Neveur from Adaris Technologies
#
# Usage : Clustall <online/offline/migrate> <nodename>
#

if [ $# != 2 ]
then
echo "[clustall] USAGE: clustall.sh <online/offline/migrate> <nodename>"
exit 1
fi
if test $1 == "online" || test $1 == "offline" || test $1 == "migrate"; then
COMMAND=$1
NODE=$2
declare -i COUNT=1
cluster status | cut -d ' ' -f1 | while read SERVER
do
if (( COUNT > 1 )); then
echo $SERVER : $COMMAND ON $NODE
cluster $COMMAND $SERVER $NODE >/dev/null
else
(( COUNT ))
fi
done
else
echo "[clustall] USAGE: clustall.sh <online/offline/migrate> <nodename>"
exit 1
fi

Tags:

Labels:

Collateral
How To-Best Practice
Comment List
Anonymous
Related Discussions
Recommended