summaryrefslogtreecommitdiff
path: root/freeradius-server.init
blob: 5529125d5f3954136ce46e9ea74d4d47abb14235 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh
#
# chkconfig:	345 88 12
# description:	Start/Stop the RADIUS server daemon
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#    Copyright (C) 2001 The FreeRADIUS Project   http://www.freeradius.org
#

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /etc/raddb/radiusd.conf ] || exit 0

checkconfig() {
	run_cmd "Checking RADIUS configuration " /usr/sbin/radiusd -C || exit 1
}

start() {
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/freeradius ]; then
		msg_starting RADIUS
		daemon /usr/sbin/radiusd
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/freeradius
	else
		msg_already_running RADIUS
	fi
}

stop() {
	# Stop daemons.
	if [ -f /var/lock/subsys/freeradius ]; then
		msg_stopping RADIUS
		killproc /usr/sbin/radiusd
		rm -f /var/lock/subsys/freeradius > /dev/null 2>&1
	else
		msg_not_running RADIUS
	fi
}

RETVAL=0
case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  status)
	status radiusd
	retvar=$?
	checkconfig
	exit $retvar
	;;
  reload|force-reload)
	if [ -f /var/lock/subsys/freeradius ]; then
		checkconfig
		msg_reloading RADIUS
		killproc /usr/sbin/radiusd -HUP
		RETVAL=$?
	else
		msg_not_running RADIUS
		exit 7
	fi
	;;
  restart)
  	checkconfig
	stop
	sleep 3
	start
	;;
  try-restart)
	if [ -f /var/lock/subsys/freeradius ]; then
		checkconfig
		stop
		sleep 3
		start
	fi
	;;
  *)
	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
	exit 3
esac

exit $RETVAL