Freeradius + MySQL At System Boot = Freeradius Failure

James Duffy eastcork75 at ymail.com
Sun Sep 6 06:52:22 CEST 2009


Based on the reply from Fajar I came up with this as my rc.local:

# MySQL startup
if [ -x /usr/local/bin/mysqld_safe ]; then
        /usr/local/bin/mysqld_safe --user=_mysql &
        echo -n ' mysqld '
fi

# Wait for the NAS table to come online - otherwise freeradius bombs!!
while ! /usr/local/bin/mysql -uradius -pradpass -e "select * from nas;" radius | grep nasname
do
         sleep 1
done

# Freeradius startup
if [ -x /usr/local/sbin/radiusd ]; then
        install -d -o _freeradius /var/run/radiusd
        echo -n ' radiusd ';     /usr/local/sbin/radiusd
fi

echo '.'

I would have thought that a simple option in freeradius that allows it to wait for mysql to startup would be nice. Am I missing something obvious here? Is there a REAL solution or does freeradius not actually work with mysql properly due to the fact its too quick to abandon it during bootup??

JD





________________________________
From: Fajar A. Nugraha <fajar at fajar.net>
To: FreeRadius users mailing list <freeradius-users at lists.freeradius.org>
Sent: Saturday, September 5, 2009 11:07:57 PM
Subject: Re: Freeradius + MySQL At System Boot = Freeradius Failure

On Sat, Sep 5, 2009 at 1:23 PM, James Duffy<eastcork75 at ymail.com> wrote:
> Hi,
>
> Am having problems using freeradius and mysql. Basically they are both set
> to start at system boot but as MySQL takes longer to get going freeradius
> bombs out with Mysql error 'Can't connect to local MySQL server through
> socket '/var/run/mysql/mysql.sock' (2)' type errors.
>
> I can 'fix' this by adding a time delay in rc.local between the mysql
> startup and radiusd startup but this does not seem like the right way to fix
> this.

You could use "mysqladmin ping" instead of simple sleep to make sure
that mysql REALLY works. Some manual hacking might be necessary
though. Something like

while ! mysqladmin ping;do echo -n .;sleep 1;done

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



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20090905/938d1536/attachment.html>


More information about the Freeradius-Users mailing list