-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployCDN
executable file
·63 lines (54 loc) · 1.7 KB
/
deployCDN
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
63
#!/bin/bash
while getopts 'p:o:n:u:i:' OPTION; do
case "$OPTION" in
p)
port=${OPTARG}
;;
o)
origin=${OPTARG}
;;
i)
keyfile=${OPTARG}
;;
n)
servername=${OPTARG}
;;
u)
username=${OPTARG}
;;
esac
done
shift $((OPTIND-1))
# DNS
ssh -o StrictHostKeyChecking=no -i $keyfile $username@97.107.140.73 <<EOF
mkdir DNS
mkdir IP2LOCATION
mkdir remotes
nohup sc_remoted -P $port -U remotes > scamper.out 2> scamper.err < /dev/null &
exit
EOF
rm IP2LOCATION/IPLocation.csv
unzip IP2LOCATION/IPLocation.csv.comp -d IP2LOCATION
scp -o StrictHostKeyChecking=no -i $keyfile ./DNS/dnsserver $username@97.107.140.73:~/DNS
scp -o StrictHostKeyChecking=no -i $keyfile ./DNS/servers.txt $username@97.107.140.73:~/DNS
scp -o StrictHostKeyChecking=no -i $keyfile ./DNS/scamperScript $username@97.107.140.73:~/DNS
scp -o StrictHostKeyChecking=no -i $keyfile ./IP2LOCATION/IPLocation.csv $username@97.107.140.73:~/IP2LOCATION &
# #HTTP
while read server; do
ssh -o StrictHostKeyChecking=no -i $keyfile $username@$server <<EOF
mkdir HTTP
mkdir cache
nohup scamper -R 97.107.140.73:$port > scamper.out 2> scamper.err < /dev/null &
exit
EOF
scp -o StrictHostKeyChecking=no -i $keyfile ./HTTP/httpserver $username@$server:HTTP
scp -o StrictHostKeyChecking=no -i $keyfile ./downloadCache $username@$server:~
scp -o StrictHostKeyChecking=no -i $keyfile ./pageviews.csv $username@$server:~
(ssh -o StrictHostKeyChecking=no -i $keyfile $username@$server <<EOF
./downloadCache
rm downloadCache
rm pageviews.csv
exit
EOF
) &
done < ./DNS/servers.txt