Add support for searching in 'prefix' dirs for headers
[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 ypbind smtp
17 # Required-Stop:     $syslog $remote_fs
18 # Should-Stop:       ypbind smtp
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
26 RADIUSD_BIN=/usr/sbin/radiusd
27 test -x $RADIUSD_BIN || { echo "$RADIUSD_BIN not installed"; \
28         if [ "$1" = "stop" ]; then exit 0;
29         else exit 5; fi; }
30
31 . /etc/rc.status
32
33 rc_reset
34 case "$1" in
35     start)
36         echo -n "Starting RADIUS daemon "
37         startproc $RADIUSD_BIN >/dev/null
38         rc_status -v    
39         ;;
40     stop)
41         echo -n "Shutting down RADIUS daemon "
42         killproc -TERM $RADIUSD_BIN 
43         rc_status -v    
44         ;;
45     try-restart|condrestart)
46         ## If first returns OK call the second, if first or
47         ## second command fails, set echo return value.
48         if test "$1" = "condrestart"; then
49                 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
50         fi
51         $0 status
52         if test $? = 0; then
53                 $0 restart
54         else
55                 rc_reset        # Not running is not a failure.
56         fi
57         rc_status
58         ;;
59     restart)
60         ## Stop the service and regardless of whether it was
61         ## running or not, start it again.
62         $0 configtest "$@" || { rc_failed $?; rc_exit; }
63         $0 stop
64         $0 start
65         rc_status
66         ;;
67     force-reload)
68         ## Signal the daemon to reload its config. Most daemons
69         ## do this on signal 1 (SIGHUP).
70         ## If it does not support it, restart.
71         $0 configtest "$@" || { rc_failed $?; rc_exit; }
72         echo -n "Reload RADIUS daemon "
73         killproc -HUP $RADIUSD_BIN
74         rc_status -v
75         ;;
76     reload)
77         ## Like force-reload, but if daemon does not support
78         ## signalling, do nothing (!)
79         $0 configtest "$@" || { rc_failed $?; rc_exit; }
80         echo -n "Reload RADIUS daemon "
81         killproc -HUP $RADIUSD_BIN 
82         rc_status -v
83         ;;
84     status)
85         echo -n "Checking for service radiusd "
86         checkproc $RADIUSD_BIN
87         rc_status -v
88         ;;
89    configtest|testconfig)
90         echo -n "Checking config for radiusd "
91         $RADIUSD_BIN -C
92         rc_status -v
93         ;;
94    debug)
95         $RADIUSD_BIN -X
96         rc_status -v
97         ;;
98     *)
99         echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|configtest|debug}"
100         exit 1
101         ;;
102 esac
103 rc_exit