Initial revision
[freeradius.git] / redhat / rc.radiusd-redhat
1 #!/bin/sh
2 # radiusd
3 # radiusd       Start the radius daemon.
4 #
5 #               This is a script suitable for the Redhat Linux distribution.
6 #               Copy it to /etc/rc.d/init.d/radiusd.init and
7 #               use tksysv or your favorite runlevel editor to start it
8 #               at runlevel 3
9 #
10 # chkconfig: 345 98 10
11 # description: Ativa/Desativa servidor Radius
12
13
14
15 # Source function library.
16 . /etc/rc.d/init.d/functions
17
18 RADIUSD=/usr/sbin/radiusd
19 WATCHER=/usr/sbin/radwatch
20 LOCKF=/var/lock/subsys/radiusd
21
22 test -f $RADIUSD || exit 0
23 test -f /etc/raddb/clients || exit 0
24
25 case "$1" in
26   start)
27         [ -f /var/log/radutmp ] || touch /var/log/radutmp
28         echo -n 'Starting RADIUSD server: '
29         if [ -x $WATCHER ]
30         then
31                 daemon $WATCHER $RADIUSD -y
32         else
33                 daemon $RADIUSD -y
34         fi
35         touch $LOCKF
36         echo "done."
37         ;;
38   stop)
39         echo -n 'Stopping RADIUSD server: '
40         if [ -x $WATCHER ]
41         then
42                 killproc $WATCHER 2> /dev/null
43         fi
44         killproc $RADIUSD 2> /dev/null
45         echo "done."
46         rm -f $LOCKF
47         ;;
48   reload|restart)
49         $0 stop
50         sleep 3
51         $0 start
52         ;;
53   *)
54         echo "Usage: $0 {start|stop|reload}"
55         exit 1
56 esac
57
58 exit 0