#!/bin/bash # # /etc/rc.d/init.d/smsd # # Starts the smsd daemon # # chkconfig: 345 70 30 # description: Send and receive SMS messages # processname: gammu-smsd ### BEGIN INIT INFO # Provides: acpid # Required-Start: $syslog $local_fs # Required-Stop: $syslog $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop smsd # Description: Send and receive SMS messages ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 OPTIONS="-d -p /var/run/smsd.pid -U smsd -G smsd -c /etc/gammu-smsdrc" # # See how we were called. # start() { echo -n $"Starting gammu sms daemon: " umask 007 daemon /usr/bin/gammu-smsd ${OPTIONS} RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smsd echo return $RETVAL } stop() { echo -n $"Stopping gammu sms daemon: " killproc /usr/bin/gammu-smsd RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smsd echo return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; condrestart) if [ -f /var/lock/subsys/smsd ]; then restart fi ;; status) status smsd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" RETVAL=2 esac exit $RETVAL