Automating the Simple Experiment: First Step (Test)
Once your experiment starts growing, it will be impractical to log on to each node to execute commands. Fortunately there is a way to automate things. Again using the simple experiment from the previous post, although it does not really need to be automated due to the small size…
Here are the script that I will now manually copy over to the client and server sides and then execute them from the terminal. Note that since I already installed iperf on VM-0 and VM-4, I chose two different machines in my graph to test these scripts
————————————————————————————————————-
CLIENT SCRIPT
————————————————————————————————————-
#!/bin/sh
# Usual directory for downloading software in ProtoGENI hosts is `/local`
cd /local
##### Check if file is there #####
if [ ! -f “./installed.txt” ]
then
#### Create the file ####
sudo touch “./installed.txt”
#### Run one-time commands ####
#Install necessary packages
sudo yum -y install iperf& EPID=$!
wait $EPID
fi
sudo /usr/bin/iperf -c VM-3 -p 5001 -t 90 -i 1 > iperf_client.txt
————————————————————————————————————-
SERVER SCRIPT
————————————————————————————————————-
#!/bin/sh
# Usual directory for downloading software in ProtoGENI hosts is `/local`
cd /local
##### Check if file is there #####
if [ ! -f “./installed.txt” ]
then
#### Create the file ####
sudo touch “./installed.txt”
#### Run one-time commands ####
#Install necessary packages
sudo yum -y install iperf& EPID=$!
wait $EPID
fi
sudo /usr/bin/iperf -s -p 5001 > iperf_server.txt
————————————————————————————————————-
I execute these scripts manually using the following commands on the two VMs
[user@VM-3]cd /local
[user@VM-3]sudo chmod +x client.sh
[user@VM-3]sudo ./server.sh
[user@VM-1]cd /local
[user@VM-1]sudo chmod +x client.sh
[user@VM-1]sudo ./client.sh
Everything went well, so I am now ready for the second step of automation…..