#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: Kai Altenfelder <ka@suse.de>, 1999-2000
#
# /etc/init.d/aprsd
#
#   and symbolic its link
#
# /usr/sbin/rcaprsd
#
### BEGIN INIT INFO
# Provides:       aprsd
# Required-Start: network
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    Start the APRS digipeater daemon
### END INIT INFO

. /etc/rc.status

# The echo return value for success (defined in /etc/rc.config).
rc_reset

case "$1" in
    start)
       echo -n "Starting service aprsd"
       ## Start daemon with startproc(8). If this fails
       ## the echo return value is set appropriate.

       startproc -s /usr/sbin/aprsd >/dev/null 2>&1
       rc_status -v 
       ;;

    stop)
       echo -n "Shutting down service aprsd"
       ## Stop daemon with killproc(8) and if this fails
       ## set echo the echo return value.

       killproc -TERM /usr/sbin/aprsd
       rc_status -v
       ;;
    try-restart)
	$0 status >/dev/null && $0 restart
	rc_status
	;;

    restart)
       $0 stop
       $0 start 
       rc_status
       ;;

    force-reload)
       ## If first returns OK call the second, if first or
       ## second command fails, set echo return value.
       $0 stop  &&  $0 start
       rc_status
       ;;

    reload)
	echo -n "Reloading service aprsd"
	rc_failed 3
	rc_status -v
	;;

    status)
       echo -n "Checking for service aprsd: "
       ## Check status with checkproc(8), if process is running
       ## checkproc will return with exit status 0.

	checkproc /usr/sbin/aprsd
	rc_status -v
	;;

    *)
       echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload}"
       exit 1
       ;;
esac

rc_exit
