diff options
author | John Klug <john.klug@multitech.com> | 2017-01-10 19:37:44 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-01-10 19:37:44 -0600 |
commit | 2dac3e03e77449b07831594555253053bc3dd61b (patch) | |
tree | d1c9e5ab90a4f943af82de91fea0ecf7da04f43e | |
parent | 058eae5c25592c7b65ebe5c7af2e1b66d930afeb (diff) | |
download | meta-mlinux-2dac3e03e77449b07831594555253053bc3dd61b.tar.gz meta-mlinux-2dac3e03e77449b07831594555253053bc3dd61b.tar.bz2 meta-mlinux-2dac3e03e77449b07831594555253053bc3dd61b.zip |
Add status to gpsd init script
-rwxr-xr-x | recipes-navigation/gpsd/gpsd/gpsd | 28 |
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 |