mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-02-02 21:43:34 +01:00
56 lines
1.3 KiB
Text
56 lines
1.3 KiB
Text
#!/sbin/runscript
|
|
|
|
extra_started_commands="reload"
|
|
|
|
depend() {
|
|
need net
|
|
use dns
|
|
}
|
|
|
|
checkconfig() {
|
|
if [ ! -d /var/run/radiusd ] && ! mkdir /var/run/radiusd ; then
|
|
eerror "Failed to create /var/run/radiusd"
|
|
return 1
|
|
fi
|
|
|
|
if [ ! -f /etc/raddb/radiusd.conf ] ; then
|
|
eerror "No /etc/raddb/radiusd.conf file exists!"
|
|
return 1
|
|
fi
|
|
|
|
RADIUSD_USER=`grep '^ *user *=' /etc/raddb/radiusd.conf | cut -d ' ' -f 3`
|
|
RADIUSD_GROUP=`grep '^ *group *=' /etc/raddb/radiusd.conf | cut -d ' ' -f 3`
|
|
if [ -n "${RADIUSD_USER}" ] && ! getent passwd ${RADIUSD_USER} > /dev/null ; then
|
|
eerror "${RADIUSD_USER} user missing!"
|
|
return 1
|
|
fi
|
|
if [ -n "${RADIUSD_GROUP}" ] && ! getent group ${RADIUSD_GROUP} > /dev/null ; then
|
|
eerror "${RADIUSD_GROUP} group missing!"
|
|
return 1
|
|
fi
|
|
|
|
local dirs=/var/run/radiusd
|
|
[ -d /var/log/radius ] && dirs="${dirs} /var/log/radius"
|
|
chown -R "${RADIUSD_USER:-root}:${RADIUSD_GROUP:-root}" ${dirs} && \
|
|
chmod -R u+rwX,g+rX ${dirs} || return 1
|
|
}
|
|
|
|
start() {
|
|
checkconfig || return 1
|
|
|
|
ebegin "Starting radiusd"
|
|
start-stop-daemon --start --quiet --exec /usr/sbin/radiusd -- ${RADIUSD_OPTS} >/dev/null
|
|
eend $?
|
|
}
|
|
|
|
stop () {
|
|
ebegin "Stopping radiusd"
|
|
start-stop-daemon --stop --quiet --pidfile=/var/run/radiusd/radiusd.pid
|
|
eend $?
|
|
}
|
|
|
|
reload () {
|
|
ebegin "Reloading radiusd"
|
|
kill -HUP `</var/run/radiusd/radiusd.pid`
|
|
eend $?
|
|
}
|