import from HEAD:
[freeradius.git] / scripts / rc.radiusd.in
1 #!/bin/sh
2 #
3 # radiusd       Start the radius daemon.
4 #
5 #    This program is free software; you can redistribute it and/or modify
6 #    it under the terms of the GNU General Public License as published by
7 #    the Free Software Foundation; either version 2 of the License, or
8 #    (at your option) any later version.
9 #
10 #    This program is distributed in the hope that it will be useful,
11 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #    GNU General Public License for more details.
14 #
15 #    You should have received a copy of the GNU General Public License
16 #    along with this program; if not, write to the Free Software
17 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 #
19 #    Copyright (C) 2001-2002 The FreeRADIUS Project http://www.freeradius.org
20
21 prefix=@prefix@
22 exec_prefix=@exec_prefix@
23 sbindir=@sbindir@
24 localstatedir=@localstatedir@
25 logdir=@logdir@
26 rundir=${localstatedir}/run/radiusd
27 sysconfdir=@sysconfdir@
28
29 #
30 #  If you have issues with OpenSSL, uncomment these next lines.
31 #
32 #  Something similar may work for MySQL, and you may also
33 #  have to LD_PRELOAD libz.so
34 #
35 #LD_LIBRARY_PATH=@OPENSSL_LIBS@
36 #LD_RUN_PATH=@OPENSSL_LIBS@:
37 #LD_PRELOAD=@OPENSSL_LIBS@libcrypto.so
38 export LD_LIBRARY_PATH LD_RUN_PATH LD_PRELOAD
39
40 RADIUSD=$sbindir/radiusd
41 RADDBDIR=@raddbdir@
42 DESC="FreeRADIUS"
43
44 #
45 #  See 'man radiusd' for details on command-line options.
46 #
47 ARGS=""
48
49 test -f $RADIUSD || exit 0
50 test -f $RADDBDIR/radiusd.conf || exit 0
51
52 case "$1" in
53   start)
54         echo -n "Starting $DESC:"
55         $RADIUSD $ARGS
56         echo "radiusd"
57         ;;
58   stop)
59         [ -z "$2" ] && echo -n "Stopping $DESC: "
60         [ -f $rundir/radiusd.pid ] && kill -TERM `cat $rundir/radiusd.pid`
61         [ -z "$2" ] && echo "radiusd."
62         ;;
63   reload|force-reload)
64         echo "Reloading $DESC configuration files."
65         [ -f $rundir/radiusd.pid ] && kill -HUP `cat $rundir/radiusd.pid`
66         ;;
67   restart)
68         sh $0 stop quiet
69         sleep 3
70         sh $0 start
71         ;;
72   *)
73         echo "Usage: /etc/init.d/$RADIUS {start|stop|reload|restart}"
74         exit 1
75 esac
76
77 exit 0