Holger Hans Peter Freyther | 9f86fa3 | 2012-06-10 04:53:33 +0800 | [diff] [blame^] | 1 | #! /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 | |
| 9 | PATH=/bin:/usr/bin:/sbin:/usr/sbin |
| 10 | |
| 11 | [ -f /etc/default/rcS ] && . /etc/default/rcS |
| 12 | [ -f /etc/default/gsmd ] && . /etc/default/gsmd |
| 13 | |
| 14 | case "$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 | ;; |
| 45 | esac |
| 46 | |
| 47 | exit 0 |