summaryrefslogtreecommitdiff
blob: 4ac13055a1395e44ec446358d5fc5909523107f6 (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
#!/sbin/runscript

depend() {
	need net
	use dns
}

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

	cd /var/log/radius #set the location of startup.log
	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() {
	# Comment out the following line to get faster startups
	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 --retry 20
	eend $?
}