1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#!/bin/sh
#
# radiusd Start the radius daemon.
#
# This is a script suitable for the Debian Linux distribution.
# Copy it to /etc/init.d/radiusd, make it executable, and
# execute "update-rc.d radiusd defaults 50".
#
RADIUSD=/usr/local/sbin/radiusd
WATCHER=/usr/local/sbin/radwatch
DESC="Cistron radius server"
NAME1=radiusd
NAME2=radwatch
ARGS="-y"
test -f $RADIUSD || exit 0
case "$1" in
start)
if [ ! -f /var/log/radutmp ]
then
:>/var/log/radutmp
fi
echo -n "Starting $DESC: "
if [ -x $WATCHER ]
then
echo -n "radwatch "
start-stop-daemon --start --quiet --startas $WATCHER \
--pidfile /var/run/$NAME2.pid --exec $RADIUSD -- $ARGS
else
start-stop-daemon --start --quiet \
--pidfile /var/run/$NAME1.pid --exec $RADIUSD -- $ARGS
fi
echo "radiusd."
;;
stop)
[ -z "$2" ] && echo -n "Stopping $DESC: "
if [ -x $WATCHER ]
then
[ -z "$2" ] && echo -n "radwatch "
start-stop-daemon --stop --quiet \
--pidfile /var/run/$NAME2.pid -- exec $RADWATCH
#killall -9 radwatch 2>/dev/null
else
start-stop-daemon --stop --quiet \
--pidfile /var/run/$NAME1.pid --exec $RADIUSD
fi
#killall radiusd 2>/dev/null
[ -z "$2" ] && echo "radiusd."
;;
reload|force-reload)
echo "Reloading $DESC configuration files."
start-stop-daemon --stop --signal 1 --quiet --pidfile \
/var/run/$NAME1.pid --exec $RADIUSD
;;
restart)
sh /etc/init.d/radiusd stop quiet
sleep 3
/etc/init.d/radiusd start
;;
*)
echo "Usage: /etc/init.d/$NAME1 {start|stop|reload|restart}"
exit 1
esac
exit 0
|