Ubuntu init script

Ng chin ye asked:

Mon Jul 28 14:30:29 2014 : Error: Failed to load virtual server inner-tunnel
Mon Jul 28 14:30:29 2014 : Error: /etc/freeradius/sites-enabled/inner-tunnel[47]: Errors parsing authorize section.
Mon Jul 28 14:30:29 2014 : Error: /etc/freeradius/sites-enabled/inner-tunnel[131]: Failed to load module "sql".
Mon Jul 28 14:30:29 2014 : Error: /etc/freeradius/sql.conf[22]: Instantiation failed for module "sql"
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Closing sqlsocket 0
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Closing sqlsocket 1
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Closing sqlsocket 2
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Closing sqlsocket 3
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Closing sqlsocket 4
Mon Jul 28 14:30:29 2014 : Error: Failed to load clients from SQL.
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0
Mon Jul 28 14:30:29 2014 : Error: rlm_sql (sql): Failed to connect DB handle #0
Mon Jul 28 14:30:29 2014 : Error: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Mon Jul 28 14:30:29 2014 : Error: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Mon Jul 28 14:30:29 2014 : Info: rlm_sql_mysql: Starting connect to MySQL server for #0
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Attempting to connect to radius@localhost:/radius
Mon Jul 28 14:30:29 2014 : Info: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Mon Jul 28 14:30:28 2014 : Error: Failed to load virtual server inner-tunnel
Mon Jul 28 14:30:28 2014 : Error: /etc/freeradius/sites-enabled/inner-tunnel[47]: Errors parsing authorize section.
Mon Jul 28 14:30:28 2014 : Error: /etc/freeradius/sites-enabled/inner-tunnel[131]: Failed to load module "sql".
Mon Jul 28 14:30:28 2014 : Error: /etc/freeradius/sql.conf[22]: Instantiation failed for module "sql"
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Closing sqlsocket 0
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Closing sqlsocket 1
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Closing sqlsocket 2
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Closing sqlsocket 3
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Closing sqlsocket 4
Mon Jul 28 14:30:28 2014 : Error: Failed to load clients from SQL.
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0
Mon Jul 28 14:30:28 2014 : Error: rlm_sql (sql): Failed to connect DB handle #0
Mon Jul 28 14:30:28 2014 : Error: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Mon Jul 28 14:30:28 2014 : Error: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Mon Jul 28 14:30:28 2014 : Info: rlm_sql_mysql: Starting connect to MySQL server for #0
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Attempting to connect to radius@localhost:/radius
Mon Jul 28 14:30:28 2014 : Info: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked

this is the daloradius log, and someone told me , it is sql services haven’t started, what is why i would like to delay the start daloradius service. belowing is my method to let daloradius service start after 200 seconds.

i would like to let the script sleep 200 seconds only start the daloradius. this is the command i had tried, but seem like not working.

start on login-session-start
script
sleep 200000
exec > freeradius -X
end script

OR

start on login-session-start
script
sleep 200000
freeradius -X
end script

and the script i save it as etc/init/VPN.conf

My answer:


Here is your problem:

Mon Jul 28 14:30:29 2014 : Error: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

This (2) means No such file or directory, i.e. the socket is not present.

Did you actually install the MySQL server?

sudo apt-get install mysql-server

Did you start the server?

sudo service mysql restart

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.