Skip to content

Commit

Permalink
rename to loggers to avoid accidental kill (ensures logging stops)
Browse files Browse the repository at this point in the history
  • Loading branch information
spennihana committed Oct 20, 2013
1 parent 197d31c commit e7085ef
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions bench/startloggers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

#ssh into each of the machines from ${JSON} (passed as first argument)
MACHINES=`cat BMscripts/$1 | python -c 'import sys, json; print json.load(sys.stdin)[sys.argv[1]]' ip | awk -F, 'OFS="," {gsub("[ u\x27\[\]]","", $0); print}'`
IFS=","
MACHINES=($MACHINES)

function startBigLoggers {
for i in ${MACHINES[@]}
do
echo "Starting bigLogger on ${i}"
scp BMLogs/starttime spencer@$i:/home/spencer/h2o/bench/BMLogs
ssh spencer@$i "cd /home/spencer/h2o/bench/BMLogs; bash bigLogger.sh" &
done
}

function startLittleLoggers {
for i in ${MACHINES[@]}
do
echo "Starting littleLogger on ${i} on phase $1"
ssh spencer@$i "cd /home/spencer/h2o/bench/BMLogs; bash littleLogger.sh $1" &
done
}

function stopLittleLoggers {
for i in ${MACHINES[@]}
do
"Stopping little loggers on machine $i"
pids=`echo spencer@$i ps ax|grep bash|grep littleLogger|awk '{print $1}'| xargs`
ssh spencer@$i kill $pids
done
}

function stopAllLoggers {
for i in ${MACHINES[@]}
do
"Stopping all loggers on machine $i"
pids=`echo ssh spencer@$i ps ax|grep bash|grep Logger|awk '{print $1}'| xargs`
ssh spencer@$i kill $pids
done
}

function changePhase {
echo "Stopping little loggers"
stopLittleLoggers >/dev/null
newPhase=$1
startLittleLoggers $1 >/dev/null
}

if [ $2 = "big" ]
then
startBigLoggers >/dev/null
fi

if [ $2 = "little" ]
then
startLittleLoggers START >/dev/null
fi

if [ $2 = "changePhase" ]
then
changePhase $3 >/dev/null
fi

if [ $2 = "stop_" ]
then
stopAllLoggers
fi

0 comments on commit e7085ef

Please sign in to comment.