packages/net/gpsd/files/gpsd.init
florian dd689ede99 [package] update gpsd to 2.94, add config, init and hotplug scripts, patch from Roberto Riggio
git-svn-id: svn://svn.openwrt.org/openwrt/packages@22447 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-07-31 22:33:32 +00:00

31 lines
631 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2009 OpenWrt.org
START=50
NAME=gpsd
PIDF=/var/run/$NAME.pid
PROG=/usr/sbin/$NAME
start() {
config_load gpsd
config_get device core device
config_get port core port
config_get_bool enabled core enabled
[ "$enabled" != "1" ] && exit
logger -t "$NAME" "Starting..."
[ ! -c "$device" ] && {
logger -t "$NAME" "Unable to find device $device. Exiting."
exit 1
}
$PROG -n -P $PIDF -S $port $device
}
stop() {
logger -t "$NAME" "Stopping..."
[ -f "$PIDF" ] && {
read PID < "$PIDF"
kill -9 $PID
rm $PIDF
}
}