-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·58 lines (50 loc) · 994 Bytes
/
run.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
53
54
55
56
57
58
#!/bin/bash
if [ $# != 6 ]
then
echo "Usage:" $0 " <server port> <board ip> <cfg> <dump file> <session name> <loop>"
exit
fi
SPORT=$1
BPORT=1234 # Fixed port number
BIP=$2
CFG=$3
DUMP_FILE=$4
SESSION_NAME=$5
loop=$6
session_exists=0
if tmux ls 2>/dev/null
then
for i in `tmux ls|awk -F ':' '{print $1}'`
do
if [ $i == $SESSION_NAME ]
then
session_exists=1
#echo "Session exists."
break
fi
done
fi
if [ $session_exists == 0 ]
then
# echo "Starting session."
tmux new -d -s $SESSION_NAME
sleep 0.1
fi
tmux select-pane -t 0
echo "Now starting server."
tmux send-keys "./trend_server $SPORT $DUMP_FILE" C-m
#sleep .5 # Needed on laptop
echo "Now sending message to board."
sleep 0.1
echo "Nloops="$loop
if [ $loop -gt 1 ]
then
for i in $(seq 1 $loop); do
echo "Now sending request" $i ", then sleep 0.1s."
./send_msg $BIP $BPORT $CFG
sleep 0.1
done
else
echo "Now sending message to board."
./send_msg $BIP $BPORT $CFG
fi