#!/bin/sh
#
# rc.aprsd   starts or stops APRSd server.
#
#
# Original Author:		Dale Heatherington <daheath@ibm.net>
# Adapted for Slackware by:	Arno Verhoeven <pe1icq@amsat.org>
#

aprsd_start() {
   if [ -r /var/run/aprsd.pid ]; then
    echo "APRSd already RUNNING!!!"
   else
    echo  -n "Starting APRS server daemon..."
   	/usr/bin/aprsd -d
	touch /var/lock/subsys/aprsd
	touch /var/run/aprsd.pid
    echo " Done."
   fi
}

aprsd_stop() {
  if [ -r /var/run/aprsd.pid ]; then
   echo -n "Stopping APRS server daemon..."
	killall aprsd
	rm -f /var/lock/subsys/aprsd
	rm -f /var/run/aprsd.pid
	echo " Done."
  else
   echo "APRSd not running!!!"
  fi
}

case "$1" in
'start')
  aprsd_start
  ;;
'stop')
  aprsd_stop
  ;;
'restart')
  aprsd_stop
  aprsd_start
  ;;
*)
  aprsd_start
esac
