New build path variable
[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 # Required-Stop:
17 # Default-Start:     3 5
18 # Default-Stop:      0 1 2 6
19 # Short-Description: RADIUS-Server
20 # Description:       Remote Authentication Dialin User Server
21 ### END INIT INFO
22
23 RADIUSD_BIN=/usr/sbin/radiusd
24 test -x $RADIUSD_BIN || { echo "$RADIUSD_BIN not installed"; \
25         if [ "$1" = "stop" ]; then exit 0;
26         else exit 5; fi; }
27
28 . /etc/rc.status
29
30 rc_reset
31 case "$1" in
32     start)
33         echo -n "Starting RADIUS daemon "
34         startproc $RADIUSD_BIN >/dev/null
35         rc_status -v    
36         ;;
37     stop)
38         echo -n "Shutting down RADIUS daemon "
39         killproc -TERM $RADIUSD_BIN 
40         rc_status -v    
41         ;;
42     try-restart|condrestart)
43         ## If first returns OK call the second, if first or
44         ## second command fails, set echo return value.
45         if test "$1" = "condrestart"; then
46                 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
47         fi
48         $0 status
49         if test $? = 0; then
50                 $0 restart
51         else
52                 rc_reset        # Not running is not a failure.
53         fi
54         rc_status
55         ;;
56     restart)
57         ## Stop the service and regardless of whether it was
58         ## running or not, start it again.
59         $0 stop
60         $0 start
61         rc_status
62         ;;
63     force-reload)
64         ## Signal the daemon to reload its config. Most daemons
65         ## do this on signal 1 (SIGHUP).
66         ## If it does not support it, restart.
67
68         echo -n "Reload RADIUS daemon "
69         killproc -HUP $RADIUSD_BIN
70         rc_status -v
71         ;;
72     reload)
73         ## Like force-reload, but if daemon does not support
74         ## signalling, do nothing (!)
75
76         echo -n "Reload RADIUS daemon "
77         killproc -HUP $RADIUSD_BIN 
78         rc_status -v
79         ;;
80     status)
81         echo -n "Checking for service radiusd "
82         checkproc $RADIUSD_BIN
83         rc_status -v
84         ;;
85     *)
86         echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
87         exit 1
88         ;;
89 esac
90 rc_exit