Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
130 | f9daq | 1 | #!/bin/bash |
2 | |||
3 | if [ "$1" == "reset" ]; then |
||
4 | cp ./input/workstation.h.in ./include/workstation.h |
||
5 | echo "Resetting the time offset to 0s." |
||
6 | else |
||
7 | ssh f9daq@f9lab04.ijs.si << EOF > ./dbg/time_offset.txt |
||
8 | date +%s |
||
9 | EOF |
||
10 | date +%s >> ./dbg/time_offset.txt |
||
11 | |||
12 | cd ./src |
||
13 | |||
14 | g++ -o offset offset.cc |
||
15 | ./offset |
||
16 | rm ./offset |
||
17 | |||
18 | cd .. |
||
19 | |||
20 | if [ -f ./dbg/time_offset_out.txt ]; then |
||
21 | offset=$(cat ./dbg/time_offset_out.txt) |
||
22 | echo "The offset of MySQL database is ${offset}s." |
||
23 | |||
24 | sed "s/define TIMEOFF 0/define TIMEOFF $offset/g" ./input/workstation.h.in > ./include/workstation.h |
||
25 | |||
26 | rm ./dbg/time_offset_out.txt |
||
27 | fi |
||
28 | |||
29 | rm ./dbg/time_offset.txt |
||
30 | fi |
||
31 | |||
32 | exit 0 |