New build path variable
[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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #
19 #    Copyright (C) 2001-2008 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 #if [ ! -d $rundir ] ; then
53 #    mkdir $rundir
54 #    chown radmin:radius $rundir
55 #    chmod 775 $rundir
56 #fi
57 #
58 #if [ ! -d $logdir ] ; then
59 #    mkdir $logdir
60 #    chown radmin:radius $logdir
61 #    chmod 770 $logdir
62 #    chmod g+s $logdir
63 #fi
64 #
65 #if [ ! -f $logdir/radius.log ]; then
66 #        touch $logdir/radius.log
67 #fi
68 #
69 #chown radmin:radius $logdir/radius.log
70 #chmod 660 $logdir/radius.log
71
72 case "$1" in
73   start)
74         echo -n "Starting $DESC:"
75         $RADIUSD $ARGS
76         echo "radiusd"
77         ;;
78   stop)
79         [ -z "$2" ] && echo -n "Stopping $DESC: "
80         [ -f $rundir/radiusd.pid ] && kill -TERM `cat $rundir/radiusd.pid`
81         [ -z "$2" ] && echo "radiusd."
82         ;;
83   reload|force-reload)
84         echo "Reloading $DESC configuration files."
85         [ -f $rundir/radiusd.pid ] && kill -HUP `cat $rundir/radiusd.pid`
86         ;;
87   restart)
88         sh $0 stop quiet
89         sleep 3
90         sh $0 start
91         ;;
92   check)
93         $RADIUSD -C $ARGS
94         ;;
95   *)
96         echo "Usage: /etc/init.d/$RADIUS {start|stop|reload|restart|check}"
97         exit 1
98 esac
99
100 exit 0