No Description

gpsd.init 753B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2009-2011 OpenWrt.org
  3. START=50
  4. NAME=gpsd
  5. PIDF=/var/run/$NAME.pid
  6. PROG=/usr/sbin/$NAME
  7. start() {
  8. config_load gpsd
  9. config_get device core device
  10. config_get port core port
  11. config_get_bool listen_globally core listen_globally
  12. config_get_bool enabled core enabled
  13. [ "$enabled" != "1" ] && exit
  14. logger -t "$NAME" "Starting..."
  15. [ ! -c "$device" ] && {
  16. logger -t "$NAME" "Unable to find device $device. Exiting."
  17. exit 1
  18. }
  19. [ "$listen_globally" != "0" ] && append args "-G"
  20. $PROG -n -P $PIDF -S $port $args $device
  21. }
  22. stop() {
  23. logger -t "$NAME" "Stopping..."
  24. [ -f "$PIDF" ] && {
  25. read PID < "$PIDF"
  26. kill -9 $PID
  27. rm $PIDF
  28. }
  29. }