import from HEAD:
[freeradius.git] / suse / rcradiusd
1 #! /bin/sh
2 # Copyright (c) 2001       SuSE GmbH Nuernberg, Germany.
3 #               2002, 2003 SuSE Linux AG, Nuernberg, Germany.
4 #
5 # Author: Wolfgang Rosenauer, 2000-2003
6 #
7 # /etc/init.d/radiusd
8 #
9 #   and symbolic its link
10 #
11 # /usr/bin/rcradiusd
12 #
13 ### BEGIN INIT INFO
14 # Provides:          radiusd
15 # Required-Start:    $network $syslog $remotefs
16 # Should-Start:      $time postgresql mysql ldap samba krb5kdc
17 # Required-Stop:
18 # Should-Stop:       $time postgresql mysql ldap
19 # Default-Start:     3 5
20 # Default-Stop:      0 1 2 6
21 # Short-Description: RADIUS-Server
22 # Description:       Remote Authentication Dialin User Server
23 ### END INIT INFO
24
25 RADIUSD_BIN=/usr/sbin/radiusd
26 test -x $RADIUSD_BIN || { echo "$RADIUSD_BIN not installed"; \
27         if [ "$1" = "stop" ]; then exit 0;
28         else exit 5; fi; }
29
30 . /etc/rc.status
31
32 rc_reset
33 case "$1" in
34     start)
35         echo -n "Starting RADIUS daemon "
36         startproc $RADIUSD_BIN >/dev/null
37         rc_status -v    
38         ;;
39     stop)
40         echo -n "Shutting down RADIUS daemon "
41         killproc -TERM $RADIUSD_BIN 
42         rc_status -v    
43         ;;
44     try-restart|condrestart)
45         ## If first returns OK call the second, if first or
46         ## second command fails, set echo return value.
47         if test "$1" = "condrestart"; then
48                 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
49         fi
50         $0 status
51         if test $? = 0; then
52                 $0 restart
53         else
54                 rc_reset        # Not running is not a failure.
55         fi
56         rc_status
57         ;;
58     restart)
59         ## Stop the service and regardless of whether it was
60         ## running or not, start it again.
61         $0 stop
62         $0 start
63         rc_status
64         ;;
65     force-reload)
66         ## Signal the daemon to reload its config. Most daemons
67         ## do this on signal 1 (SIGHUP).
68         ## If it does not support it, restart.
69
70         echo -n "Reload RADIUS daemon "
71         killproc -HUP $RADIUSD_BIN
72         rc_status -v
73         ;;
74     reload)
75         ## Like force-reload, but if daemon does not support
76         ## signalling, do nothing (!)
77
78         echo -n "Reload RADIUS daemon "
79         killproc -HUP $RADIUSD_BIN 
80         rc_status -v
81         ;;
82     status)
83         echo -n "Checking for service radiusd "
84         checkproc $RADIUSD_BIN
85         rc_status -v
86         ;;
87     *)
88         echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
89         exit 1
90         ;;
91 esac
92 rc_exit