summaryrefslogtreecommitdiff
blob: b8e69350c459796aa016fe59bfd1c007ac42f4ac (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
44
45
46
47
48
49
50
51
52
53
54
#!/sbin/runscript

opts="${opts} reload"

depend() {
	need net
	use dns
}

checkconfig() {
	if [ ! -f /etc/raddb/radiusd.conf ] ; then
		eerror "No /etc/raddb/radiusd.conf file exists!"
		return 1
	fi

	if [ "`/usr/sbin/check-radiusd-config >/dev/null 2>&1; echo $?`" != "0" ] ; then
		eerror "Config not ok! (try /usr/sbin/check-radiusd-config )"
		return 1
	fi

	if [ -z "`grep radiusd /etc/passwd`" ] || [ -z "`grep radiusd /etc/group`" ]; then
		eerror "radiusd user missing!"
		return 1
	fi

	if [ ! -f radius.log ]; then
		touch radius.log && chown radiusd:radiusd radius.log \
			|| return 1
	fi
	
	return 0
}

start() {
	cd /var/log/radius #set the location of log files
	# Comment out the following line to get faster startups
	checkconfig || return 1

	ebegin "Starting radiusd"
	start-stop-daemon --start --quiet --exec /usr/sbin/radwatch -- /usr/sbin/radiusd ${RADIUSD_OPTS} >/dev/null
	eend $?
}

stop () {
	ebegin "Stopping radiusd"
	start-stop-daemon --stop --quiet --pidfile=/var/run/radiusd/radwatch.pid
	eend $?
}

reload () {
	ebegin "Reloading radiusd"
	start-stop-daemon --stop --signal HUP --quiet --pidfile=/var/run/radiusd/radiusd.pid
	eend $?
}