diff --git a/README.md b/README.md index 83bcaed..cc15967 100644 --- a/README.md +++ b/README.md @@ -160,26 +160,39 @@ Tooling: Linux Systemd ------------- -This is very much a first stab. Do the following at root. +First make sure 'ubxtool' has been compiled (run: make ubxtool). Then, as +root: ``` -mkdir /run/ubxtool mkdir /usr/local/ubxtool -cp ubxtool.sh /usr/local/ubxtool/ -chmod +x /usr/local/ubxtool/ubxtool.sh -cp ubxtool /usr/local/ubxtool/ -cp ubxtool.service /etc/systemd/system/ubxtool.service -touch /usr/local/ubxtool/destination -touch /usr/local/ubxtool/station +cp ubxtool ubxtool.sh /usr/local/ubxtool/ +cp ubxtool.service /etc/systemd/system/ ``` -Then edit /usr/local/ubxtool/destination with an IP address collected from Bert. -Then edit /usr/local/ubxtool/station with a station number collected from Bert. -The start up the service. +Then collect the server IP address (SERVER-IP) and a station number +(STATION-NUMBER) as described in [operator.md], and run: + ``` -sudo systemctl enable ubxtool -sudo systemctl start ubxtool +echo SERVER-IP > /usr/local/ubxtool/destination +echo STATION-NUMBER > /usr/local/ubxtool/station ``` -This will be cleaned up and better packaged sometime soon. + +Then start up the service (as root): +``` +systemctl enable ubxtool +systemctl start ubxtool +``` + +To check if it is all working, do 'service ubxtool status'. + +To change the default constellations, create a file called +/usr/local/ubxtool/constellations and set your favorites. To set all four +constellations (which only F9-receivers support), do as root: + +``` +echo --gps --glonass --beidou --galileo > /usr/local/ubxtool/constellations +``` + +And then 'service ubxtool restart'. Distributed setup ----------------- diff --git a/ubxtool.service b/ubxtool.service index f556b8e..efc7178 100644 --- a/ubxtool.service +++ b/ubxtool.service @@ -17,3 +17,4 @@ ExecStart=/usr/local/ubxtool/ubxtool.sh [Install] WantedBy=multi-user.target + diff --git a/ubxtool.sh b/ubxtool.sh old mode 100644 new mode 100755 index 5d159ff..a886e17 --- a/ubxtool.sh +++ b/ubxtool.sh @@ -5,6 +5,11 @@ CONSTELLATIONS="--galileo --gps --glonass" # CONSTELLATIONS="--galileo --gps --beidou" # CONSTELLATIONS="--galileo --gps --glonass --beidou" # only on the F9P +if [ -e /usr/local/ubxtool/constellations ] +then + CONSTELLATIONS=$(cat /usr/local/ubxtool/constellations) +fi + # DEVICE="/dev/ttyACM0" # comment out or leave blank to auto-search ######################################################################### @@ -33,9 +38,9 @@ fi DESTINATION=$(cat /usr/local/ubxtool/destination) STATION=$(cat /usr/local/ubxtool/station) + # systemctl script will do this, but if you don't use systemctl, we need to take care of it [[ -d ${runDir} ]] || mkdir -p ${runDir} -[[ -e ${runDir}/gps.sock ]] || mkfifo ${runDir}/gps.sock for logFile in stdout stderr logfile do @@ -43,4 +48,4 @@ do done -exec /usr/local/ubxtool/ubxtool --wait ${CONSTELLATIONS} --port ${DEVICE} --station ${STATION} --destination ${DESTINATION} >> ${runDir}/stdout.log 2>> ${runDir}/stderr.log < /dev/null +exec /usr/local/ubxtool/ubxtool ${CONSTELLATIONS} --port ${DEVICE} --station ${STATION} --destination ${DESTINATION} >> ${runDir}/stdout.log 2>> ${runDir}/stderr.log < /dev/null