-
Notifications
You must be signed in to change notification settings - Fork 0
/
osx.sh
executable file
·36 lines (31 loc) · 952 Bytes
/
osx.sh
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
HOST=Jasons-MacBook-Pro.local
PORT=5001
RATE=10
POOL_SIZE=8
BATCH_SIZE=30
BATCH_TIME=5
DIR="$( cd "$( dirname "$0" )" && pwd )"
BUILD="$DIR/build/classes/java/main"
COMPILE="$( ps -ef | grep [c]s455.scaling.server.Server )"
SCRIPT="cd $BUILD; java -cp . cs455.scaling.client.Client $HOST $PORT $RATE;"
function new_tab() {
osascript \
-e "tell application \"Terminal\"" \
-e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
-e "do script \"$SCRIPT\" in front window" \
-e "end tell" > /dev/null
}
if [ -z "$COMPILE" ]
then
LINES=`find . -name "*.java" -print | xargs wc -l | grep "total" | awk '{$1=$1};1'`
echo Project has "$LINES" lines
gradle clean; gradle build
open -a Terminal .
pushd $BUILD; java -cp . cs455.scaling.server.Server $PORT $POOL_SIZE $BATCH_SIZE $BATCH_TIME; popd;
else
for tab in {1..5}
do
new_tab
done
eval $SCRIPT
fi