-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathec2
More file actions
executable file
·38 lines (35 loc) · 1.48 KB
/
ec2
File metadata and controls
executable file
·38 lines (35 loc) · 1.48 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
#!/bin/bash
KEY="~/.ssh/harri-aws.pem"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
HOSTNAME=''
function init {
echo "Initialising EC2 instance..."
ssh -oStrictHostKeyChecking=no -i $KEY ec2-user@$HOSTNAME 'wget -O - https://gist.githubusercontent.com/HarriBellThomas/18765ab05474a1f38d3a870147f90374/raw/18457d029ca38ead14c7c7c8ccad3f8a68497003/bubblegum-setup.sh | bash' > /dev/null 2>&1
update
echo "VM prepared."
}
function update {
echo "Copying files..."
scp -oStrictHostKeyChecking=no -i $KEY $DIR/target/bubblegum-core-1.0.0-jar-with-dependencies.jar $DIR/simulation.yml $DIR/log4j.xml ec2-user@$HOSTNAME:~ > /dev/null 2>&1
}
if [ $# -gt 1 ]; then
HOSTNAME=$1
if [ $2 == "sim" ]; then
ssh -oStrictHostKeyChecking=no -i $KEY ec2-user@$HOSTNAME 'wget -O - https://gist.githubusercontent.com/HarriBellThomas/2de5b5d214d05b055044e77dc1d68432/raw/7a6c99404bb2ac8110022413e9000ee0c26678c7/bubblegum-simulate.sh | bash' > /dev/null 2>&1
elif [ $2 == "stat" ]; then
ssh -oStrictHostKeyChecking=no -i $KEY ec2-user@$HOSTNAME 'tail -f output.txt; bash -l'
elif [ $2 == "c" ]; then
init
elif [ $2 == "u" ]; then
update
elif [ $2 == "i" ]; then
ssh -oStrictHostKeyChecking=no -i $KEY ec2-user@$HOSTNAME
elif [ $2 == "r" ]; then
scp -oStrictHostKeyChecking=no -pr -i $KEY ec2-user@$HOSTNAME:~/logs/ $DIR/recordings/$3
elif [ $2 == "chain" ]; then
init
ssh -oStrictHostKeyChecking=no -i $KEY ec2-user@$HOSTNAME 'export BOOTSTRAP "$3"'
sim
# stat
fi
fi