I use this simple old script to restart freeRadius once our dialup person has edited the users file with a file editor on our server. What I want is for it to email a specific email address in the case of a typo being made in the users file and freeRadius could not be restarted.

Can anyone tell me how to do that?

Thanks

Matthew

#!/bin/bash
#
##Docs say not to use this anymore but it works fine for us yet
#
# A simple script to see if we need to restart radius because of
# a change in the user file.
#
# should be called from a cron job... oh say every 5 min
#

FLAGFILE="/etc/raddb/radius_timestamp";
TARGETFILE="/etc/raddb/users";
USERFILE="/home/dialup/users.txt";

if [ $USERFILE -nt $FLAGFILE ]; then
       rm -r $TARGETFILE;
       cp -f $USERFILE $TARGETFILE;
       chmod 600 $TARGETFILE;
       chown dialup:dialup $USERFILE;
       chmod 600 $USERFILE;
       echo "reloading RADIUS";
       /etc/init.d/radiusd restart;
       touch $FLAGFILE;
fi;

exit 0;



- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to