mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
56837f7a6b
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
69 lines
1 KiB
Bash
69 lines
1 KiB
Bash
#!/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
|