1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #! /bin/bash -eu
- # Copyright (C) 2014 mru@sisyphus.teil.cc
- # this is only an example.
- # called by the gps_watch_monitor.py when the watch is connected.
- # starts the watch client to import new tracks, starts mytourbook
- # to customize this script,
- # copy it to ~/.gps_watch_onconnect.sh and modify it to suit your needs.
- #serial_device=$1
- destdir=$HOME/rides
- mkdir -p $destdir
- mkdir -p $destdir/images
- cd $destdir
- now_fn=$(date +%F_%T | tr ':' '_')
- trap '{
- echo "failed to receive watch data";
- }' ERR
- sleep 1
- # echo "downloading MTK7d.EPO"
- # echo
- # curl -u krippl-gps-master:master -o MTK7d.EPO ftp://ftp.krippl-watches.com/AGPS/MTK7d.EPO
- # echo
- echo "importing data"
- echo
- crane_gps_watch_client --verbose --split --clear
- echo
- # start mytourbook
- tb=~/opt/tourbook/mytourbook/mytourbook
- if [[ -z "$(pgrep -f $tb)" ]]; then
- # if mytourbook is not started, start it
- echo "starting $tb"
- nohup $tb &
- else
- # else bring it to front
- wmctrl -a $(basename $tb) || true
- fi
- wait
- echo
- echo "completed"
|