Add script which sets LD_LIBRARY_PATH, etc, so that OpenSSL
[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 RADIUSD=$sbindir/radiusd
30 RADDBDIR=@raddbdir@
31 DESC="FreeRADIUS"
32
33 #
34 #  See 'man radiusd' for details on command-line options.
35 #
36 ARGS=""
37
38 test -f $RADIUSD || exit 0
39 test -f $RADDBDIR/radiusd.conf || exit 0
40
41 case "$1" in
42   start)
43         echo -n "Starting $DESC:"
44         $RADIUSD $ARGS
45         echo "radiusd"
46         ;;
47   stop)
48         [ -z "$2" ] && echo -n "Stopping $DESC: "
49         [ -f $rundir/radiusd.pid ] && kill -TERM `cat $rundir/radiusd.pid`
50         [ -z "$2" ] && echo "radiusd."
51         ;;
52   reload|force-reload)
53         echo "Reloading $DESC configuration files."
54         [ -f $rundir/radiusd.pid ] && kill -HUP `cat $rundir/radiusd.pid`
55         ;;
56   restart)
57         sh $0 stop quiet
58         sleep 3
59         sh $0 start
60         ;;
61   *)
62         echo "Usage: /etc/init.d/$RADIUS {start|stop|reload|restart}"
63         exit 1
64 esac
65
66 exit 0