Include sources needed by RPM packages
[moonshot.git] / rpm-sources / freeradius-radiusd-init
1 #!/bin/sh
2 #
3 # radiusd Start/Stop the FreeRADIUS daemon
4 #
5 # chkconfig: - 88 10
6 # description: Extensible, configurable, high performance RADIUS server.
7
8 ### BEGIN INIT INFO
9 # Provides: radiusd
10 # Required-Start: $network
11 # Required-Stop:
12 # Default-Start:
13 # Default-Stop:
14 # Should-Start: $time $syslog mysql ldap postgresql samba krb5-kdc
15 # Should-Stop:
16 # Short-Description: FreeRADIUS server
17 # Description: Extensible, configurable, high performance RADIUS server.
18 ### END INIT INFO
19
20 # Source function library.
21 . /etc/rc.d/init.d/functions
22
23 prog=radiusd
24
25 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
26
27 exec=${exec:=/usr/sbin/$prog}
28 config_dir=${config_dir:=/etc/raddb}
29 config=${config:=$config_dir/radiusd.conf}
30 pidfile=${pidfile:=/var/run/$prog/$prog.pid}
31 lockfile=${lockfile:=/var/lock/subsys/radiusd}
32
33 start() {
34     [ -x $exec ] || exit 5
35     [ -f $config ] || exit 6
36     echo -n $"Starting $prog: "
37     daemon --pidfile $pidfile $exec -d $config_dir
38     retval=$?
39     echo
40     [ $retval -eq 0 ] && touch $lockfile
41     return $retval
42 }
43
44 stop() {
45     echo -n $"Stopping $prog: "
46     killproc -p $pidfile $prog
47     retval=$?
48     echo
49     [ $retval -eq 0 ] && rm -f $lockfile
50     return $retval
51 }
52
53 restart() {
54     stop
55     start
56 }
57
58 reload() {
59     # radiusd may not be capable of a 100% configuration reload depending
60     # on which loadable modules are in use, if sending the server a
61     # HUP is not sufficient then use restart here instead. However, we
62     # prefer by default to use HUP since it's what is usually desired.
63     #    
64     # restart
65
66     kill -HUP `pidofproc -p $pidfile $prog`
67 }
68
69 force_reload() {
70     restart
71 }
72
73 rh_status() {
74     # run checks to determine if the service is running or use generic status
75     status -p $pidfile $prog
76 }
77
78 rh_status_q() {
79     rh_status >/dev/null 2>&1
80 }
81
82
83 case "$1" in
84     start)
85         rh_status_q && exit 0
86         $1
87         ;;
88     stop)
89         rh_status_q || exit 0
90         $1
91         ;;
92     restart)
93         $1
94         ;;
95     reload)
96         rh_status_q || exit 7
97         $1
98         ;;
99     force-reload)
100         force_reload
101         ;;
102     status)
103         rh_status
104         ;;
105     condrestart|try-restart)
106         rh_status_q || exit 0
107         restart
108         ;;
109     *)
110         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
111         exit 2
112 esac
113 exit $?