]>
Commit | Line | Data |
---|---|---|
9a70fe84 TB |
1 | #!/bin/bash |
2 | ||
3 | DIR=$(dirname `readlink -f $0`) | |
4 | . $DIR/testing.conf | |
b5f3c1f7 | 5 | SSHCONF="-F $DIR/ssh_config" |
9a70fe84 TB |
6 | |
7 | if [ $# == 0 ] | |
8 | then | |
9 | echo "$0 <host>" | |
10 | exit 1 | |
11 | fi | |
12 | ||
13 | host=$1 | |
45ee7c94 TB |
14 | echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*" |
15 | if [ $? -eq 0 ] | |
9a70fe84 | 16 | then |
45ee7c94 TB |
17 | # assume we got an ip address |
18 | ip=$host | |
19 | else | |
eeb02936 TB |
20 | pos='$1' |
21 | echo "$host" | grep -q ".*1$" | |
22 | if [ $? -eq 0 ] | |
23 | then | |
24 | # {host}1, use second address | |
25 | pos='$2' | |
26 | host=`echo "$host" | sed -n -e "s/1$//p"` | |
27 | fi | |
28 | ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, "{ print ${pos} }" | awk '{ print $1 }'`" | |
45ee7c94 TB |
29 | if [ -z $ip ] |
30 | then | |
31 | echo "Host '$host' unknown" | |
32 | exit 1 | |
33 | fi | |
9a70fe84 TB |
34 | fi |
35 | ||
50574556 TB |
36 | shift |
37 | exec ssh $SSHCONF -q root@$ip $@ |