-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstopCDN
More file actions
executable file
·54 lines (45 loc) · 979 Bytes
/
stopCDN
File metadata and controls
executable file
·54 lines (45 loc) · 979 Bytes
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
#!/bin/bash
OPTINDEX=1
# Initialize our own variables:
port=""
origin=""
name=""
user=""
identity=""
numhost=$(wc -l < ./ec2-hosts.txt)
while getopts "p:o:n:u:i:" opt; do
case "$opt" in
p) port=$OPTARG
;;
o) origin=$OPTARG
;;
n) name=$OPTARG
;;
u) user=$OPTARG
;;
i) identity=$OPTARG
;;
esac
done
shift $((OPTIND-1))
echo "Running stopCDN against the following arguments:"
echo "port=$port, origin=$origin, name=$name, user=$user, identity=$identity"
echo ""
i=0
host=($(cut -d$'\t' -f1 ./ec2-hosts.txt))
for h in "${host[@]}"; do
echo ""
echo "Attempting to stop host ${h}"
echo ""
ssh -oStrictHostKeyChecking=no -i $identity $user@$h << ENDSSH &> /dev/null
pkill python &> /dev/null
exit
ENDSSH
done
echo ""
echo "Attempting to stop dns server"
echo ""
ssh -oStrictHostKeyChecking=no -i $identity $user@cs5700cdnproject.ccs.neu.edu << ENDSSH &> /dev/null
pkill python &> /dev/null
exit
ENDSSH