Browse Source

changed cloud-init

master
Sebastian Rieger 7 years ago
parent
commit
df21c66d6a
  1. 20
      VerteilteSysteme-Examples/src/verteiltesysteme/aws/user-data.txt

20
VerteilteSysteme-Examples/src/verteiltesysteme/aws/user-data.txt

@ -1,10 +1,24 @@
#!/bin/bash
VERTSYS_PATH="/home/ec2-user/verteilte-systeme-bsc-ai-examples/VerteilteSysteme-Examples/build/"
SCRIPT_ROOT_PATH="/tmp/init-script"
VERTSYS_PATH="$SCRIPT_ROOT_PATH/verteilte-systeme-bsc-ai-examples/VerteilteSysteme-Examples/build/"
#JARS = "TCPServer.jar TCPServerMulti.jar UDPServer.jar UDPServerMulti.jar UDPTimeCounterServer.jar TCPPerfServer.jar"
JARS="TCPServer.jar TCPPerfServer.jar UDPServer.jar UDPTimeCounterServer.jar"
REPO="https://gogs.informatik.hs-fulda.de/srieger/verteilte-systeme-bsc-ai-examples.git"
mkdir $SCRIPT_ROOT_PATH
cd $SCRIPT_ROOT_PATH
wget http://169.254.169.254/latest/user-data
chmod +x user-data
wget http://169.254.169.254/latest/meta-data/placement/availability-zone
echo "PS1='[\u@\h@`cat /tmp/init-script/availability-zone` \W]$ '" >>/root/.bashrc
echo "PS1='[\u@\h@`cat /tmp/init-script/availability-zone` \W]$ '" >>/home/ec2-user/.bashrc
while ! ping -c 1 -W 1 8.8.8.8; do
echo "Waiting for 8.8.8.8 - network interface might be down..."
sleep 1
done
echo "Installing packages..."
sudo yum update -y
sudo yum install -y java git
@ -16,7 +30,7 @@ fi
# Example for path and contents:
#
#/home/ec2-user/verteilte-systeme-bsc-ai-examples/VerteilteSysteme-Examples/build/
# ./verteilte-systeme-bsc-ai-examples/VerteilteSysteme-Examples/build/
#
#build-server-jars.xml TCPServerMulti.jar
#RMIEchoServer.jar UDPServer.jar
@ -28,7 +42,7 @@ killall screen
echo "Starting JARS: ${JARS}..."
for JAR in $JARS; do
echo "Starting ${JAR}..."
sudo screen -dmS $JAR java -jar $VERTSYS_PATH/$JAR
sudo screen -dmS $JAR -L java -jar $VERTSYS_PATH/$JAR
done
sleep 5

Loading…
Cancel
Save