get_info.sh 2.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#!/bin/bash

INF="/proj/PhantomNet/binh/simeca_scripts/get_interface_map.pl"


#NODE1
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node1" ]; then
	echo "#Node $hn..."
	n1_a_dev=$($INF | grep neta | awk '{print $3}')
	n1_a_mac=$(ifconfig | grep $n1_a_dev | awk '{print $5}')
12
	n1_a=$(ifconfig | grep -A3 $n1_a_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
13 14 15

	n1_c_dev=$($INF | grep netc | awk '{print $3}')
	n1_c_mac=$(ifconfig | grep $n1_c_dev | awk '{print $5}')
16
	n1_c=$(ifconfig | grep -A3 $n1_c_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
	echo "n1_a=\"$n1_a\""
	echo "n1_a_mac=\"$n1_a_mac\""
	echo "n1_a_dev=\"$n1_a_dev\""
	echo "n1_c=\"$n1_c\""
	echo "n1_c_mac=\"$n1_c_mac\""
	echo "n1_c_dev=\"$n1_c_dev\""
fi


#NODE2
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node2" ]; then
	echo "#Node $hn..."
	n2_a_dev=$($INF | grep neta | awk '{print $3}')
	n2_a_mac=$(ifconfig | grep $n2_a_dev | awk '{print $5}')
32
	n2_a=$(ifconfig | grep -A3 $n2_a_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
33 34 35

	n2_b_dev=$($INF | grep netb | awk '{print $3}')
	n2_b_mac=$(ifconfig | grep $n2_b_dev | awk '{print $5}')
36
	n2_b=$(ifconfig | grep -A3 $n2_b_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
	echo "n2_a=\"$n2_a\""
	echo "n2_a_mac=\"$n2_a_mac\""
	echo "n2_a_dev=\"$n2_a_dev\""
	echo "n2_b=\"$n2_b\""
	echo "n2_b_mac=\"$n2_b_mac\""
	echo "n2_b_dev=\"$n2_b_dev\""

fi


#NODE3
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node3" ]; then
	echo "#Node $hn..."
	n3_b_dev=$($INF | grep netb | awk '{print $3}')
	n3_b_mac=$(ifconfig | grep $n3_b_dev | awk '{print $5}')
53
	n3_b=$(ifconfig | grep -A3 $n3_b_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
54 55 56

	n3_d_dev=$($INF | grep netd | awk '{print $3}')
	n3_d_mac=$(ifconfig | grep $n3_d_dev | awk '{print $5}')
57
	n3_d=$(ifconfig | grep -A3 $n3_d_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
	echo "n3_b=\"$n3_b\""
	echo "n3_b_mac=\"$n3_b_mac\""
	echo "n3_b_dev=\"$n3_b_dev\""
	echo "n3_d=\"$n3_d\""
	echo "n3_d_mac=\"$n3_d_mac\""
	echo "n3_d_dev=\"$n3_d_dev\""
fi


#NODE4
hn=$(hostname | awk -F'.' '{print $1}')
if [ "$hn" == "node4" ]; then
	echo "#Node $hn..."
	n4=$($INF)
	n4_c_dev=$($INF | grep netc | awk '{print $3}')
	n4_c_mac=$(ifconfig | grep $n4_c_dev | awk '{print $5}')
74
	n4_c=$(ifconfig | grep -A3 $n4_c_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
75 76 77

	n4_d_dev=$($INF | grep netd | awk '{print $3}')
	n4_d_mac=$(ifconfig | grep $n4_d_dev | awk '{print $5}')
78
	n4_d=$(ifconfig | grep -A3 $n4_d_dev | grep inet6 | awk '{print $3}' | awk -F'/' '{print $1}' | sed s/fe80::/2001::/ )
79 80 81 82 83 84 85 86 87
	echo "n4_c=\"$n4_c\""
	echo "n4_c_mac=\"$n4_c_mac\""
	echo "n4_c_dev=\"$n4_c_dev\""
	echo "n4_d=\"$n4_d\""
	echo "n4_d_mac=\"$n4_d_mac\""
	echo "n4_d_dev=\"$n4_d_dev\""
fi