summaryrefslogtreecommitdiff
path: root/recipes-navigation
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-navigation')
-rwxr-xr-xrecipes-navigation/gpsd/gpsd/gpsd28
1 files changed, 27 insertions, 1 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd
index d9cf201..9c59f10 100755
--- a/recipes-navigation/gpsd/gpsd/gpsd
+++ b/recipes-navigation/gpsd/gpsd/gpsd
@@ -63,6 +63,7 @@ do_start()
gpsctl -t 'u-blox' -s $GPS_BAUD -b -f $GPS_LINE
# The next line is needed due to a bug in gpsctl.
# We will go back to the default baud rate if we don't do this step.
+ echo Expect a timeout error here. Need this error.
gpsctl -T 2 -f $GPS_LINE
stty -F $GPS_LINE $GPS_BAUD
/usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \
@@ -104,6 +105,19 @@ do_reload() {
return 0
}
+do_status() {
+ NAME=$1
+ PIDFILE=$2
+ # -t: test only but not stop
+ start-stop-daemon -K -t --quiet --pidfile $PIDFILE --name $NAME
+ # exit with status 0 if process is found
+ if [ "$?" = "0" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
case "$1" in
start)
echo "Starting $DESC" "$NAME"
@@ -116,7 +130,19 @@ case "$1" in
exit $?
;;
status)
- ;;
+ echo -n "status $NAME ... "
+ do_status "$NAME" "$PIDFILE"
+ if [ "$?" = "0" ]; then
+ echo "running"
+ exit 0
+ else
+ echo "stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
+ ;;
reload|force-reload)
echo "Reloading $DESC" "$NAME"
do_reload