Internal/VirtualPL/ParallelImaging: imageNodes5

File imageNodes5, 2.6 KB (added by shruti, 18 years ago)
Line 
1#!/bin/bash
2default_image="orbit-parallel"
3
4# Set up pxe links on repository2 for pxe boot
5
6nodeset=""
7sub=`/sbin/ifconfig eth1 | grep 'inet addr' | cut -c21-26`
8processLine_before(){
9line="$@" # get all args
10echo $line > node
11node_x=`cut -f1 -d',' node`
12node_y=`cut -f2 -d',' node`
13node_id="node"$node_x"-"$node_y
14subnet_ip=$sub$node_x"."$node_y
15echo "My subnet number is $subnet_ip"
16wget -O - "http://pxe:5012/pxe/setBootImage?img=$default_image&node=$node_id&ip=$subnet_ip"
17# Reset the selected nodes using cmc service
18wget -O - "http://cmc:5012/cmc/on?x=$node_x&y=$node_y"
19wget -O - "http://cmc:5012/cmc/reset?x=$node_x&y=$node_y"
20nodeset=$nodeset" "$node_id
21}
22
23processLine_after(){
24line="$@" # get all args
25echo "$line" > node
26node_x=`cut -f1 -d',' node`
27node_y=`cut -f2 -d',' node`
28node_id="node"$node_x"-"$node_y
29subnet_ip=$sub$node_x"."$node_y
30wget -O - "http://pxe:5012/pxe/clearBootImage?node=$node_id&ip=$subnet_ip"
31wget -O - "http://cmc:5012/cmc/reset?x=$node_x&y=$node_y"
32}
33cp $1 /usr/$1
34processLine_gexec(){
35line="$@" # get all args
36echo "$line" > node
37node_x=`cut -f1 -d',' node`
38node_y=`cut -f2 -d',' node`
39node_id="node"$node_x"-"$node_y
40export GEXEC_SVRS="$node_id"
41subnet_ip=$sub$node_x"."$node_y
42cd /usr
43gexec -n 0 frisbee -p $port -m $multicast -i $subnet_ip /dev/hda &
44}
45
46
47FILE=""
48# Make sure we get file name as command line argument
49# Else read it from standard input device
50if [ "$1" == "" ]; then
51FILE="/dev/stdin"
52else
53FILE="$1"
54# make sure file exist and readable
55if [ ! -f $FILE ]; then
56echo "$FILE : does not exists"
57exit 1
58elif [ ! -r $FILE ]; then
59echo "$FILE: can not read"
60exit 2
61fi
62fi
63# read $FILE using the file descriptors
64exec 3<&0
65exec 0<$FILE
66while read line
67do
68# use $line variable to process line in processLine() function
69processLine_before $line
70done
71echo "$nodeset"
72exec 0<&3
73
74sleep 120
75
76# Launch the frisbee server
77export LD_ASSUME_KERNEL="2.4.2"
78wget -O - "http://frisbee:5012/frisbee/getAddress?img=$2" > PORT
79
80port=`cut -c 11-15 PORT`
81multicast=`cut -c 0-9 PORT`
82FILE="$1"
83exec 3<&0
84exec 0<$FILE
85while read line
86do
87#use $line variable to process line in processLine() function
88processLine_gexec $line
89done
90
91sleep 380
92
93#sleep 180
94#export GEXEC_SVRS="$nodeset"
95#export LD_ASSUME_KERNEL="2.4.2"
96#cd /etc
97#gexec -n 0 frisbee -p $port -m 224.0.0.2 -i $subnet_ip /dev/hda
98
99FILE="$1"
100exec 3<&0
101exec 0<$FILE
102while read line
103do
104# use $line variable to process line in processLine() function
105processLine_after $line
106done
107
108
109function usage()
110{
111echo "Usage: $0 {atheros|intel|all} image_file_path" >&2
112echo "for example:" >&2
113echo " $0 all tmp/image-tridencom-test.ndz" >&2
114}
115if [ $# -ne 2 ]
116then
117echo "ERROR: Wrong number of arguments: $1"
118usage
119exit 1
120fi