-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern.sh
executable file
·56 lines (48 loc) · 1.07 KB
/
pattern.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
#/bin/bash
# Pattern run
# Parameters: pattern mode
if [ $# != 2 ]
then
echo "Usage:" $0 "<board ID> <pattern type>"
exit
fi
# Configuration
BOARDID=$1
#DATADIR=$HOME/data
echo "DATADIR="$DATADIR
echo "Reading $DATADIR/last_run.txt"
NRUN=$(<$DATADIR/last_run.txt) # Cannot be executed within a python script.
echo 'Present run ID' $NRUN
NRUN=$(($NRUN+1))
echo 'New run ID' $NRUN
if [ $2 = "0" ]
then
patterncfg=pattern_zeros.cfg
elif [ $2 = "1" ]
then
patterncfg=pattern_ones.cfg
elif [ $2 = "2" ]
then
patterncfg=pattern_toggle.cfg
elif [ $2 = "3" ]
then
patterncfg=pattern_deskew.cfg
elif [ $2 = "4" ]
then
patterncfg=pattern_sync.cfg
else
echo 'Wrong parameter value. Aborting.'
exit 0
fi
echo 'Calling ' $patterncfg
# Clean
tmux kill-window -t "w"
# Execute run
$DAQDIR/run.sh 1236 192.168.1.1$BOARDID $patterncfg $DATADIR/P$NRUN'_b'$BOARDID.data "w" 0
#sleep 2
# Log run id
cp $patterncfg $DATADIR/P$NRUN'_b'$BOARDID.cfg
rm $DATADIR/last_run.txt
echo $NRUN >> $DATADIR/last_run.txt
echo "Now killing tmux window w."
tmux kill-window -t "w"