aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeradius/radiusd.initd
blob: 5e3a0b4e34e2db626389c85fb75a482ece123fde (plain)
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
#!/sbin/openrc-run

name="FreeRADIUS"
description_checkconfig="Check configuration"
description_reload="Reload configuration"

extra_commands="checkconfig"
extra_started_commands="reload"

: ${cfgfile:="/etc/raddb/radiusd.conf"}
cfgname="${cfgfile##*/}"

command="/usr/sbin/radiusd"
# RADIUSD_OPTS is for backward compatibility only
command_args="-f -d ${cfgfile%/*} -n ${cfgname%.conf} ${command_args:-$RADIUSD_OPTS}"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

required_files="$cfgfile"

depend() {
	need net
	after firewall
	use dns
}

start_pre() {
	# XXX: Is this still needed?
	checkpath -d -m 0755 -o radius:radius /run/radiusd
	checkconfig
}

checkconfig() {
	ebegin "Checking $name configuration"
	$command $command_args -C || $command $command_args -Cx -lstdout
	eend $?
}

reload () {
	ebegin "Reloading $name"
	start-stop-daemon --signal HUP --pidfile "$pidfile"
	eend $?
}