From 2e4ef073b06f5ede526c44b20054e19e68b9770b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Sun, 23 Nov 2014 12:37:40 +0100 Subject: [PATCH] Add script to start/stop Gobi GPS (user must be in dialout group) --- bin/gobigps | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 bin/gobigps diff --git a/bin/gobigps b/bin/gobigps new file mode 100755 index 0000000..9cf9b7e --- /dev/null +++ b/bin/gobigps @@ -0,0 +1,37 @@ +#!/bin/bash + +GPSDEV=/dev/ttyUSB0 + + + +startstop() { + DO=$1 + + echo "\$GPS_${DO^^}" > $GPSDEV + + if [ $? -eq 0 ]; + then + echo -e "[ \e[01;32mOK\e[0m ]\tGPS $DO" + else + echo -e "[ \e[01;31m!!\e[0m ]\tSomenthing went wrong. Cannot $DO GPS" + exit 1 + fi +} + + +if [ ! -w $GPSDEV ]; +then + echo $"Current user $(whoami) doesn't have permission to write to ${GPSDEV}. Please add it to the 'dialout' group." + exit 1 +fi + + +case "$1" in + +'start' | 'stop') + startstop $1 + ;; +*) + echo $"Usage: $0 [start|stop]" + exit 1 ;; +esac