Commit 6f20fb2e authored by Anton Agapov's avatar Anton Agapov

Simplification of glusterupdate.sh

parent 8aa28580
...@@ -3,89 +3,35 @@ ...@@ -3,89 +3,35 @@
host="snail lin-test cellar windsor nun lav vbox asu multi space1 localhost" host="snail lin-test cellar windsor nun lav vbox asu multi space1 localhost"
client="euclid atlant grape" client="euclid atlant grape"
gfs_query(){ run_on_hosts(){
for i in $host for i in $host
do do
echo $i echo $i
ssh $i 'bash -s' <<< "epm -q glusterfs3-server" ssh $i 'bash -s' <<< "$@"
done done
} }
gfs_policy(){ run_on_clients(){
for i in $host for i in $client
do
echo $i
ssh $i 'bash -s' <<< "apt-get update; apt-get policy glusterfs3-server"
done
}
gfs_install(){
for i in $host
do do
echo $i echo $i
ssh $i 'bash -s' <<< "epmi glusterfs3-server" ssh $i 'bash -s' <<< "$@"
done done
} }
gfs_stop(){ gfs_stop(){
for i in $host run_on_hosts umount /var/ftp/*; killall glusterfs
do run_on_hosts monit stop glusterd
echo $i run_on_hosts killall glusterd
ssh $i 'bash -s' <<< "umount /var/ftp/*; killall glusterfs" run_on_hosts killall glusterfsd
done
for i in $host
do
echo $i
ssh $i 'bash -s' <<< "monit stop glusterd"
done
for i in $host
do
echo $i
ssh $i 'bash -s' <<< "killall glusterd"
done
for i in $host
do
echo $i
ssh $i 'bash -s' <<< "killall glusterfsd"
done
} }
gfs_start(){ gfs_start(){
for i in $host run_on_hosts monit start glusterd
do sleep 5
echo $i run_on_hosts service glusterd start
ssh $i 'bash -s' <<< "monit start glusterd"
done
sleep 5
for i in $host
do
echo $i
ssh $i 'bash -s' <<< "service glusterd start"
done
}
gfs_mount(){
for i in $host
do
echo $i
ssh $i 'bash -s' <<< "mount -a"
done
} }
gfs_client(){
for i in $client
do
echo $i
ssh $i 'bash -s' <<< "umount /var/ftp/*; killall glusterfs; epmi glusterfs3-client; mount /var/ftp/*"
done
}
gfs_mount_plus(){ gfs_mount_plus(){
echo 'Remount /var/ftp/* at cellar:' echo 'Remount /var/ftp/* at cellar:'
ssh cellar 'bash -s' <<< "/root/bin/remount.sh /var/ftp/pub; /root/bin/remount.sh /var/ftp/pvt; /root/bin/remount.sh /var/ftp/tmp" ssh cellar 'bash -s' <<< "/root/bin/remount.sh /var/ftp/pub; /root/bin/remount.sh /var/ftp/pvt; /root/bin/remount.sh /var/ftp/tmp"
...@@ -102,20 +48,26 @@ gfs_mount_plus(){ ...@@ -102,20 +48,26 @@ gfs_mount_plus(){
case $1 in case $1 in
all) all)
gfs_install run_on_hosts epmi glusterfs3-server
gfs_stop gfs_stop
gfs_start gfs_start
gfs_mount run_on_hosts mount -a
run_on_clients umount /var/ftp/*; killall glusterfs; epmi glusterfs3-client; mount /var/ftp/*
gfs_mount_plus
exit 0
;;
simulate)
run_on_hosts epm simulate glusterfs3-server
exit 0 exit 0
;; ;;
install) install)
gfs_install run_on_hosts epmi glusterfs3-server
exit 0 exit 0
;; ;;
noinstall) noinstall)
gfs_stop gfs_stop
gfs_start gfs_start
gfs_mount run_on_hosts mount -a
exit 0 exit 0
;; ;;
stop) stop)
...@@ -124,11 +76,11 @@ case $1 in ...@@ -124,11 +76,11 @@ case $1 in
;; ;;
start) start)
gfs_start gfs_start
gfs_mount run_on_hosts mount -a
exit 0 exit 0
;; ;;
mount) mount)
gfs_mount run_on_hosts mount -a
exit 0 exit 0
;; ;;
mount_plus) mount_plus)
...@@ -136,18 +88,18 @@ case $1 in ...@@ -136,18 +88,18 @@ case $1 in
exit 0 exit 0
;; ;;
query) query)
gfs_query run_on_hosts epm -q glusterfs3-server
exit 0 exit 0
;; ;;
policy) policy)
gfs_policy run_on_hosts apt-get update; apt-get policy glusterfs3-server
exit 0 exit 0
;; ;;
client) client)
gfs_client run_on_clients umount /var/ftp/*; killall glusterfs; epmi glusterfs3-client; mount /var/ftp/*
exit 0 exit 0
;; ;;
*) *)
echo 'One word is needed as arg: query, policy, start, stop, mount, install, noinstall, all. Try again...' echo 'One word is needed as arg: query, simulate, policy, start, stop, mount, install, noinstall, all. Try again...'
;; ;;
esac esac
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment