aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/freesmartphone/fso-gpsd/fso-gpsd
blob: a101008e5a87df4a607480dee61a8a5b9762efa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /bin/sh
#
# fso-gpsd -- This shell script starts and stops the freemsmartphone.org gpsd compatibility daemon
#
# chkconfig: 345 70 30
# description: fso-gpsd is the freesmartphone.org gpsd compatibility daemon
# processname: fso-gpsd

PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=fso-gpsd

[ -f /etc/default/rcS ] && . /etc/default/rcS

case "$1" in
    start)
        echo -n "Starting freesmartphone.org gpsd compatibility daemon: "
        start-stop-daemon --start --pidfile /var/run/${NAME}.pid --exec /usr/sbin/fso-gpsd -- -S localhost:gpsd -P /var/run/${NAME}.pid

        if [ $? = 0 ]; then
            echo "(ok)"
        else
            echo "(failed)"
        fi
        ;;
    stop)
        echo -n "Stopping freesmartphone.org gpsd compatibility daemon: "
        start-stop-daemon --stop --pidfile /var/run/${NAME}.pid --oknodo
        rm -f /var/run/${NAME}.pid
        echo "(done)"
        ;;
    restart|force-reload)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: /etc/init.d/fso-gpsd {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0