Ensure we leave room for the trailing NUL
[freeradius.git] / scripts / rc.radiusd.in
index f6a38be..4cc04ab 100755 (executable)
@@ -14,9 +14,9 @@
 #
 #    You should have received a copy of the GNU General Public License
 #    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 #
-#    Copyright (C) 2001-2002 The FreeRADIUS Project http://www.freeradius.org
+#    Copyright (C) 2001-2008 The FreeRADIUS Project http://www.freeradius.org
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
@@ -24,6 +24,18 @@ sbindir=@sbindir@
 localstatedir=@localstatedir@
 logdir=@logdir@
 rundir=${localstatedir}/run/radiusd
+sysconfdir=@sysconfdir@
+
+#
+#  If you have issues with OpenSSL, uncomment these next lines.
+#
+#  Something similar may work for MySQL, and you may also
+#  have to LD_PRELOAD libz.so
+#
+#LD_LIBRARY_PATH=@OPENSSL_LIBS@
+#LD_RUN_PATH=@OPENSSL_LIBS@:
+#LD_PRELOAD=@OPENSSL_LIBS@libcrypto.so
+export LD_LIBRARY_PATH LD_RUN_PATH LD_PRELOAD
 
 RADIUSD=$sbindir/radiusd
 RADDBDIR=@raddbdir@
@@ -37,6 +49,26 @@ ARGS=""
 test -f $RADIUSD || exit 0
 test -f $RADDBDIR/radiusd.conf || exit 0
 
+#if [ ! -d $rundir ] ; then
+#    mkdir $rundir
+#    chown radmin:radius $rundir
+#    chmod 775 $rundir
+#fi
+#
+#if [ ! -d $logdir ] ; then
+#    mkdir $logdir
+#    chown radmin:radius $logdir
+#    chmod 770 $logdir
+#    chmod g+s $logdir
+#fi
+#
+#if [ ! -f $logdir/radius.log ]; then
+#        touch $logdir/radius.log
+#fi
+#
+#chown radmin:radius $logdir/radius.log
+#chmod 660 $logdir/radius.log
+
 case "$1" in
   start)
        echo -n "Starting $DESC:"
@@ -57,8 +89,11 @@ case "$1" in
        sleep 3
        sh $0 start
        ;;
+  check)
+       $RADIUSD -C $ARGS
+       ;;
   *)
-        echo "Usage: /etc/init.d/$RADIUS {start|stop|reload|restart}"
+        echo "Usage: /etc/init.d/$RADIUS {start|stop|reload|restart|check}"
         exit 1
 esac