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 <[email protected]>
To: FreeRadius users mailing list <[email protected]>
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<[email protected]> 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
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html