#! /bin/bash DEFAULT=/etc/default/gpsd START_DAEMON="false" DEVICES="/dev/ttyKYM11" [ -r $DEFAULT ] && . $DEFAULT if [ "$START_DAEMON" != "true" ]; then exit 1 fi do_start() { chat -v ABORT ERROR TIMEOUT 10 '' ATZ OK AT@74=user@au.au-net.ne.jp OK AT@75=au OK AT@70=3 OK AT@76=1 OK AT@77=0,1 OK AT@72 OK '' < $DEVICES > $DEVICES return 0 } do_stop() { chat -v ABORT ERROR TIMEOUT 10 '' AT@73 OK ATZ OK '' < $DEVICES > $DEVICES return 0 } case "$1" in start) do_start ;; stop) do_stop ;; restart) do_stop do_start ;; *) echo "Usage: $0 {start|stop|restart}" >&2 exit 3 ;; esac :