-
Notifications
You must be signed in to change notification settings - Fork 8
/
cooja_sdn-wise.sh
executable file
·52 lines (42 loc) · 1.33 KB
/
cooja_sdn-wise.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
trap 'killallp' INT
killallp() {
trap '' INT TERM # ignore INT and TERM while shutting down
echo -n "> Sleepy run_misses shutting down... " # added double quotes
kill -TERM 0 # fixed order, send TERM not INT
wait
echo "DONE"
}
killall tail
# $1 make args
# $2 simulation
RESULTSDIR="/home/mike/Results/SDN_WISE"
CONTIKIDIR="/home/mike/Repos/sdn-wise-contiki/sdn-wise"
COOJADIR="/home/mike/Repos/sdn-wise-contiki/contiki/tools/cooja/"
COOJALOG="$COOJADIR/build/COOJA.testlog"
SIMULATION="/home/mike/Repos/sdn-wise-contiki/sdn-wise/$1"
TARGET="sky"
copylogs() {
echo -n "> Copy logs... "
mkdir -p $RESULTS_DIR
cp $COOJA_LOG/* $RESULTS_DIR
echo "DONE"
}
compile() {
echo "*** Compiling... $1 ***"
gnome-terminal --tab --title=$2 -- bash -c "cd $CONTIKIDIR;make clean TARGET=$TARGET && make TARGET=$TARGET $1;echo \"***FINISHED*** $1\";exec bash"
sleep 5
}
run_cooja() {
echo "*** Run Cooja... $1 ***"
gnome-terminal --tab --title=$2 -- bash -c "cd $COOJADIR;ant run_nogui -file $COOJADIR -Dargs=$SIMULATION;echo \"***FINISHED*** $SIMULATION\";exec bash"
}
echo START
ARGS="$2"
compile "SINK=1 $ARGS" sink
mv $CONTIKIDIR/sdn-wise.$TARGET $CONTIKIDIR/sink.$TARGET
compile "SINK=0 $ARGS" node
mv $CONTIKIDIR/sdn-wise.$TARGET $CONTIKIDIR/sink.$TARGET
run_cooja
echo FINISHED!
wait < <(jobs -p)