blob: dc10e63098122e920e57d613ee9d984f4802d742 [file] [log] [blame]
Holger Hans Peter Freyther9f86fa32012-06-10 04:53:33 +08001#! /bin/sh
2#
3# gsmd This shell script starts and stops gsmd.
4#
5# chkconfig: 345 90 40
6# description: Gsmd manages access to a serial- or USB-connected GSM
7# processname: gsmd
8
9PATH=/bin:/usr/bin:/sbin:/usr/sbin
10
11[ -f /etc/default/rcS ] && . /etc/default/rcS
12[ -f /etc/default/gsmd ] && . /etc/default/gsmd
13
14case "$1" in
15 start)
16 [ -n "$GSM_POW" ] && ( echo "0" >$GSM_POW; sleep 1 )
17 [ -n "$GSM_POW" ] && ( echo "1" >$GSM_POW; sleep 1 )
18 [ -n "$GSM_RES" ] && ( echo "1" >$GSM_RES; sleep 1 )
19 [ -n "$GSM_RES" ] && ( echo "0" >$GSM_RES; sleep 2 )
20
21 echo -n "Starting GSM daemon: "
22 start-stop-daemon -S -x /usr/sbin/gsmd -- gsmd -p $GSM_DEV $GSMD_OPTS -d -l syslog
23
24 if [ $? = 0 ]; then
25 echo "gsmd."
26 else
27 echo "(failed.)"
28 fi
29 ;;
30 stop)
31 [ -n "$GSM_POW" ] && echo "0" >$GSM_POW
32
33 echo -n "Stopping GSM daemon: "
34 start-stop-daemon -K -x /usr/sbin/gsmd
35 echo "gsmd."
36 ;;
37 restart|force-reload)
38 $0 stop
39 $0 start
40 ;;
41 *)
42 echo "Usage: /etc/init.d/gsmd {start|stop|restart|force-reload}"
43 exit 1
44 ;;
45esac
46
47exit 0