summaryrefslogtreecommitdiff
path: root/packages/gsm/files/fic-gta01/gsmd
blob: 3c3f63a4df8843359d8a092a6cb6a60ae8498e11 (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
42
43
44
45
46
47
48
49
50
51
##!/bin/sh
#
# gsmd  This shell script starts and stops gsmd.
#
# chkconfig: 345 90 40
# description: Gsmd manages access to a serial- or USB-connected GSM
# processname: gsmd

PATH=/bin:/usr/bin:/sbin:/usr/sbin

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

case "$1" in
    start)
        stty -F "$GSM_DEV" -crtscts
        [ -n "$GSM_POW" ] && ( echo "0" >$GSM_POW; sleep 1 )
        [ -n "$GSM_POW" ] && ( echo "1" >$GSM_POW; sleep 1 )
        [ -n "$GSM_RES" ] && ( echo "1" >$GSM_RES; sleep 1 )
        [ -n "$GSM_RES" ] && ( echo "0" >$GSM_RES; sleep 2 )

        echo -n "Starting GSM daemon: "
        start-stop-daemon -S -x /usr/sbin/gsmd -- gsmd -p $GSM_DEV $GSMD_OPTS >/tmp/gsm.log 2>&1 &

        if [ $? = 0 ]; then
            echo "gsmd."
        else
            echo "(failed.)"
        fi
        ;;
    stop)
        [ -n "$GSM_POW" ] && echo "0" >$GSM_POW

        echo -n "Stopping GSM daemon: "
        start-stop-daemon -K -x /usr/sbin/gsmd
        stty -F "$GSM_DEV" -crtscts
        echo "gsmd."
        ;;
    restart|force-reload)
        $0 stop
        $0 start
        exit
        ;;
    *)
        echo "Usage: /etc/init.d/apmd {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0