Blame |
Last modification |
View Log
| RSS feed
#!/bin/bash
if [ "$1" == "reset" ]; then
cp ./input/workstation.h.in ./include/workstation.h
echo "Resetting the time offset to 0s."
else
ssh f9daq@f9lab04.ijs.si << EOF > ./dbg/time_offset.txt
date +%s
EOF
date +%s >> ./dbg/time_offset.txt
cd ./src
g++ -o offset offset.cc
./offset
rm ./offset
cd ..
if [ -f ./dbg/time_offset_out.txt ]; then
offset=$(cat ./dbg/time_offset_out.txt)
echo "The offset of MySQL database is ${offset}s."
sed "s/define TIMEOFF 0/define TIMEOFF $offset/g" ./input/workstation.h.in > ./include/workstation.h
rm ./dbg/time_offset_out.txt
fi
rm ./dbg/time_offset.txt
fi
exit 0