forked from zsyqq/CS5700
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunCDN
executable file
·54 lines (50 loc) · 1.75 KB
/
runCDN
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
#! /bin/bash
hostnames=(ec2-54-84-248-26.compute-1.amazonaws.com
ec2-54-186-185-27.us-west-2.compute.amazonaws.com
ec2-54-215-216-108.us-west-1.compute.amazonaws.com
ec2-54-72-143-213.eu-west-1.compute.amazonaws.com
ec2-54-255-143-38.ap-southeast-1.compute.amazonaws.com
ec2-54-199-204-174.ap-northeast-1.compute.amazonaws.com
ec2-54-206-102-208.ap-southeast-2.compute.amazonaws.com
ec2-54-207-73-134.sa-east-1.compute.amazonaws.com)
while getopts "p:o:u:n:i:" arg
do
case $arg in
p) # Port
# echo "port:$OPTARG"
port=$OPTARG
;;
o) # Origin server
# echo "origin:$OPTARG"
origin=$OPTARG
;;
u) # username
# echo "username:$OPTARG"
username=$OPTARG
;;
n) # CDN-specific name
# echo "name:$OPTARG"
name=$OPTARG
;;
i) #private key
# echo "keyfile:$OPTARG"
keyfile=$OPTARG
;;
?)
echo "unkonw argument"
exit 1
;;
esac
done
for host in "${hostnames[@]}"
do
echo $host
# Run server in the background on target machine
# Refer to: http://goo.gl/Tp23ww
ssh -i $keyfile -n -f $username@$host "sh -c 'cd ~/scripts/; nohup python measurer.py > /dev/null 2>&1 &'"
ssh -i $keyfile -n -f $username@$host "sh -c 'cd ~/scripts/; nohup ./httpserver -p $port -o $origin > /dev/null 2>&1 &'"
done
dnsserver=cs5700cdnproject.ccs.neu.edu
echo $dnsserver
# ssh -i $keyfile -n -f yummin@$dnsserver "sh -c 'cd ~/scripts/; nohup ./dnsserver -p $port -n $name > /dev/null 2>&1 &'"
ssh -i $keyfile -n -f $username@$dnsserver "sh -c 'cd ~/scripts/; nohup ./dnsserver -p $port -n $name > /dev/null 2>&1 &'"