-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·39 lines (32 loc) · 797 Bytes
/
update.sh
File metadata and controls
executable file
·39 lines (32 loc) · 797 Bytes
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
#!/bin/bash
my_dir="$(dirname "$0")"
source $my_dir/config.sh
if [[ $wd == "" ]]; then
echo "Working directory not set"
exit 1
fi
rm -f node-data.tar
cd node-data && tar --dereference -cf ../node-data.tar . || (echo "Error while creating the archive"; exit 1)
cd ../
function install {
echo "-- $1 - Update started..."
scp -q node-data.tar $username@$1:$wd/node.tar
output=`ssh $username@$1 "cd $wd && tar -xf node.tar" 2>&1`
if [[ $output == "" ]]; then
echo "-- $1 - Success"
else
echo -e "-- $1 - OUTPUT:\n$output"
fi
}
while read host; do
if [[ $host =~ ^#.* ]] || [[ $host == '' ]]; then
continue
fi
install $host &
if [[ $1 == '-f' ]]; then
# Fast mode set.
break;
fi
done < nodes.txt
# Wait for all installation processes to finish
wait