-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreplay.sh
More file actions
executable file
·64 lines (55 loc) · 1.62 KB
/
Copy pathreplay.sh
File metadata and controls
executable file
·64 lines (55 loc) · 1.62 KB
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
64
#! /bin/bash
# Replay script for mininet
if [ $# -ne 8 ]; then
echo "Enter site to fetch, hostmapping file, network path of mirror, mininet config, phantomjs path, quic path, congestion control, browser"
exit 5;
fi
# Exterminate old versions of Mininet
./clean_up_mn.sh
# Kill old residues
sudo killall -s9 /usr/bin/python
sudo killall -s9 quic_server
sudo killall -s9 Xvfb
sudo service dnsmasq stop
sudo killall -s9 dnsmasq
sudo service apache2 stop
sudo killall -s9 apache2
# Remove old log
sudo rm /var/dnsmasq.log
set -e
# cmdline args
site=$1
hostmapping=$2
mirror_folder_network_path=$3
server_ips=$4
phantomjs=$5
quic_path=$6
cc=$7
browser=$8
# Rewrite /etc/hosts
scp $hostmapping /etc/hosts
cp /etc/resolv.conf /etc/resolv.conf_orig
cp resolv.conf.tmpl /etc/resolv.conf
if [ $cc == "cubic" ]; then
mirror_root_folder=`echo $site | cut -f 3 -d '/'`
rm -rf /var/www/$mirror_root_folder
scp -r $mirror_folder_network_path /var/www/$mirror_root_folder
#modify apache root folder
sed s/"DocumentRoot \/var\/www"/"DocumentRoot \/var\/www\/$mirror_root_folder"/g default.backup > /etc/apache2/sites-available/default
elif [ $cc == "quic" ]; then
mirror_root_folder=`echo $site | cut -f 3 -d '/'`
scp -r $mirror_folder_network_path $quic_path/$mirror_root_folder
else
exit 5;
fi
# Run Mininet
scp $server_ips server_ips.txt
python web_mirror_replay.py $server_ips $site $phantomjs $quic_path $cc $browser
# Restore etc hosts
cp hosts_default /etc/hosts
# Restore apache default file
if [ $cc == "cubic" ]; then
cp default.backup /etc/apache2/sites-available/default
fi
#Restore resolv.conf
mv /etc/resolv.conf_orig /etc/resolv.conf