e9b1ec28d0edc52f8e08e6aff1d027e4aef29b44
[samba.git] / ctdb / tests / bench-ssh.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4     echo "Usage: bench-ssh.sh <NODES> <OPTIONS>"
5     exit 1
6 fi
7
8 while :; do
9     if [ "`echo $1 | cut -c1`" = "-" -o $# -eq 0 ]; then break; fi
10     nodes="$nodes $1";
11     shift;
12 done
13
14 options=$*
15 dir=`pwd`
16
17 echo "Creating nodes-ssh.txt"
18 rm -f nodes-ssh.txt
19 count=0
20 for h in $nodes; do
21     echo "$h:9001" >> nodes-ssh.txt
22     count=`expr $count + 1`
23 done
24
25
26 echo "Killing old processes"
27 for h in $nodes; do
28     scp -q nodes-ssh.txt $h:$dir
29     ssh $h killall -q ctdb_bench
30 done
31
32 echo "Starting nodes"
33 i=0
34 for h in $nodes; do
35     if [ $i -eq `expr $count - 1` ]; then
36         ssh $h $dir/bin/ctdb_bench --nlist $dir/nodes-ssh.txt --listen $h:9001 --socket $h$options
37     else
38         ssh -f $h $dir/bin/ctdb_bench --nlist $dir/nodes-ssh.txt --listen $h:9001 --socket $h $options
39     fi
40     i=`expr $i + 1`
41 done
42
43 wait