#!/bin/sh # @author Michael Klier # small tool to import gps track info from a garmin edge 205 GPS_DIR=/home/chi/gps GPS_BIN=/usr/bin/gpsbabel if [ "$UID" != "0" ]; then echo "ERROR: only root can run this script" exit 1 fi if [ ! -n "$1" ]; then DATE=$(date +%Y%m%d) else DATE=$1 fi cd $GPS_DIR $GPS_BIN -t -i garmin -f usb: -x track,start=${DATE}0001,stop=${DATE}2359 -o gpx -F ${DATE}.gpx if [ -f ${DATE}.gpx ]; then # "empty" track files contain exactly 9 lines if [ $(cat ${DATE}.gpx | wc -l) == "9" ]; then rm ${DATE}.gpx else chown chi:chi ${DATE}.gpx fi fi exit 0