summaryrefslogtreecommitdiff
path: root/source4/cluster/ctdb/tests/bench-ssh.sh
blob: 0d11ee9cdd8025bc0fb87358ea72ea52b19f34c0 (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
#!/bin/sh

if [ $# -lt 1 ]; then
    echo "Usage: bench-ssh.sh <NODES> <OPTIONS>"
    exit 1
fi

while :; do
    if [ "`echo $1 | cut -c1`" = "-" -o $# -eq 0 ]; then break; fi
    nodes="$nodes $1";
    shift;
done

options=$*
dir=`pwd`

echo "Creating nodes-ssh.txt"
rm -f nodes-ssh.txt
count=0
for h in $nodes; do
    echo "$h:9001" >> nodes-ssh.txt
    count=`expr $count + 1`
done


echo "Killing old processes"
for h in $nodes; do
    scp -q nodes-ssh.txt $h:$dir
    ssh $h killall -q ctdb_bench
done

echo "Starting nodes"
i=0
for h in $nodes; do
    if [ $i -eq `expr $count - 1` ]; then
	ssh $h $dir/bin/ctdb_bench --nlist $dir/nodes-ssh.txt --listen $h:9001 $options
    else
	ssh -f $h $dir/bin/ctdb_bench --nlist $dir/nodes-ssh.txt --listen $h:9001 $options
    fi
    i=`expr $i + 1`
done

wait