diff options
Diffstat (limited to 'ham/aprx/rc.aprx.new')
-rw-r--r-- | ham/aprx/rc.aprx.new | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ham/aprx/rc.aprx.new b/ham/aprx/rc.aprx.new new file mode 100644 index 0000000000..d5cc498eca --- /dev/null +++ b/ham/aprx/rc.aprx.new @@ -0,0 +1,69 @@ +#!/bin/sh +# +# aprx daemon control script. +# Written for Slackware Linux by JK Wood <joshuakwood@gmail.com> + +BIN=/sbin/aprx +CONF=/etc/aprx.conf +PID=/var/run/aprx.pid + +aprx_start() { + # Sanity checks. + if [ ! -r $CONF ]; then # no config file, exit: + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PID ]; then + echo "aprx appears to already be running?" + exit 1 + fi + + echo "Starting aprx daemon..." + if [ -x $BIN ]; then + $BIN -f $CONF + fi +} + +aprx_stop() { + echo "Shutdown aprx gracefully..." + if [ -r $PID ]; then + kill -HUP $(cat $PID) + rm -f $PID + else + killall -HUP -q aprx + fi + echo +} + +aprx_restart() { + aprx_stop + sleep 3 + aprx_start +} + +aprx_status() { + if [ -e $PID ]; then + echo "aprx is running." + else + echo "arpx is stopped." + exit 1 + fi +} + +case "$1" in + start) + aprx_start + ;; + stop) + aprx_stop + ;; + restart) + aprx_restart + ;; + status) + aprx_status + ;; + *) + echo "usage: `basename $0` {start|stop|restart|status}" +esac |