Created
May 9, 2013 13:32
-
-
Save nmccready/5547455 to your computer and use it in GitHub Desktop.
start script to kick off a master and then slaves via ssh across multiple machines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#start script to kick off a master and then slaves via ssh across multiple machines | |
RUN_AS=${1:-$(whoami)} | |
SLAVE_CMD="nohup locust -f /opt/swarm//app1/some_locust_script.py --slave --master-host=testbox1.locust.com --host=http://someurlToHammer:9000 &>/dev/null &" | |
MASTER_CMD="nohup locust -f /opt/swarm/app1/some_locust_script.py --master --host=http://someurlToHammer:9000 &>/dev/null &" | |
start_instances() | |
{ | |
CMD=$1 | |
SERVER=$2 | |
INSTANCES=$3 | |
echo "Running as '$RUN_AS', running command $CMD on server $SERVER $INSTANCES times" | |
for j in $(seq 1 "$INSTANCES") | |
do | |
ssh -i ~/.ssh/id_rsa -t "$RUN_AS"@"$SERVER" "$CMD" &>/dev/null & | |
echo slave instance "$j" running | |
sleep .25 | |
done | |
} | |
#locust documentation specifies that a master should start first, and then slaves | |
#https://github.com/locustio/locust/blob/master/docs/quickstart.rst | |
#start master | |
start_instances "$MASTER_CMD" testbox1.locust.com 1 | |
sleep 5 | |
#start slaves | |
#for i in $(echo 1) | |
for i in $(echo {1,2,3,6,7,8,9}) | |
do | |
start_instances "$SLAVE_CMD" testbox$i.locust.com 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment