blob: 9b5c6fa3b958cb7cd237c8b3f46efb629cb2be3d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/bin/bash
function _init ()
{
set -u;
VERSION=$1;
if [ $# -lt 2 ]; then
upgrade="no";
else
if [ $2 == "yes" ]; then
upgrade="yes";
else
upgrade="no";
fi
fi
}
function install_glusterfs ()
{
local remote_server=;
if [ $# -eq 1 ]; then
remote_server=$1;
fi
if [ $remote_server ]; then
ssh $remote_server cp -f /root/scripts/rpm_download_install.sh /root/;
ssh $remote_server /root/rpm_download_install.sh $VERSION $upgrade;
return 0;
fi
j=0;
for i in $(cat /root/machines)
do
j=$(($j+1));
(install_glusterfs $i)&
done
}
function install_my_glusterfs ()
{
old_PWD=$PWD;
cd /root;
cp /root/scripts/rpm_download_install.sh /root/;
/root/rpm_download_install.sh $VERSION $upgrade;
cd $old_PWD;
return 0;
}
function main ()
{
stat --printf=%i /root/machines 2>/dev/null 1>/dev/null;
if [ $? -ne 0 ]; then
echo "servers file is not present /root. Cannot execute further.";
exit 1;
fi
install_glusterfs;
for i in $(1 $j)
do
wait %$j;
done
install_my_glusterfs;
return 0;
}
_init "$@" && main "$@"
|