-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLaunchService.sh
executable file
·62 lines (52 loc) · 1.6 KB
/
LaunchService.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
# Run it in the dir where "WriteMIME.py" is!
# This scripts instantiates a number of WNs uing the EC2 API
# mailto: [email protected]
# Configuration goes here: ########
config_file="config/ConfigureCE.ccfg"
#config_file="config/ConfigureSE.ccfg"
list_modules="IncludeModules.txt"
image="ami-00000363"
flavour="t2.ce"
#flavour="t2.test.service"
#flavour="t2.se"
outfile="NewService.log"
###################################
echo -e "\e[32mI'm going to instantiate a service with the following configuration:\e[0m"
echo -e "\e[33mConfiguration file:\e[0m $config_file"
echo -e "\e[33mList of modules:\e[0m $list_modules"
echo -e "\e[33mBase image:\e[0m $image"
echo -e "\e[33mFlavour:\e[0m $flavour"
echo -e "\e[32mIs this ok (yes/no)?\e[0m"
read conf
if [ "$conf" == "yes" ]; then
echo "I go for it..."
else
echo "Aborting."
exit
fi
echo -e "\e[32mWriting temporary list...\e[0m"
echo "${list_modules}:x-include-url" > tmp.txt
echo "${config_file}:multiple-config" >> tmp.txt
echo -e "\e[32mCreating user-data archive...\e[0m"
name=`echo $config_file | grep -o -P '(?<=config/Configure).*(?=.ccfg)'`
userdata="userdata${name}.txt.gz"
./WriteMIME.py tmp.txt
ls -rtlh $userdata
#exit
rm tmp.txt
echo -e "\e[32mRunning command:\e[0m"
echo `date` > $outfile
cmd="euca-run-instances $image -t $flavour -f $userdata"
echo $cmd
$cmd | sed 1d | \
#euca-describe-instances | sed 1d | \
while read i
do
a=($i)
id_on=${a[1]}
ip_last=`echo ${a[3]} | cut -c 11-13`
echo "$id_on t2-vwn-$ip_last.to.infn.it" >> $outfile
done
echo -e "\e[32mList of new instances and hostnames written in:\e[0m"
ls -rtlh $outfile