forked from bloomberg/comdb2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient
More file actions
executable file
·46 lines (38 loc) · 1.01 KB
/
client
File metadata and controls
executable file
·46 lines (38 loc) · 1.01 KB
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
#!/bin/bash
# create and distribute ssh key
mkdir ~/.ssh
chmod 700 ~/.ssh
cp /common/id_rsa* ~/.ssh/
chmod 700 ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
export CLUSTER="$(cat common/cluster)"
echo "CLUSTER is $CLUSTER"
export DEDICATED_NETWORK_SUFFIXES='-n3 -n4'
# wait for all the nodes to signal that they're ready
numnodes=0
for node in $CLUSTER; do
numnodes=$(($numnodes+1))
done
echo numnodes $numnodes
declare -A ready
while :; do
for node in $CLUSTER; do
host=$(ssh -o StrictHostKeyChecking=no $node hostname 2>/dev/null)
if [[ $? -eq 0 && "$host" == $node ]]; then
ready[$node]=1
fi
done
ready=0
for node in $CLUSTER; do
[[ ${ready[$node]} = 1 ]] && ready=$(($ready+1))
done
[[ $ready -eq $numnodes ]] && break
done
ssh-keyscan $CLUSTER >> ~/.ssh/known_hosts 2>/dev/null
if [[ $# -ne 0 ]]; then
eval $*
fi
echo READY
if [[ -f /common/user_script ]]; then
/common/user_script $(cat /common/user_script_args 2>/dev/null)
fi