Ubuntu 启动脚本

Ubuntu 启动脚本
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

这是daloradius日志,有人告诉我,这是sql服务尚未启动,为什么我想延迟启动daloradius服务。下面是我让daloradius服务在200秒后启动的方法。

我想让脚本休眠 200 秒,然后启动 daloradius。这是我尝试过的命令,但似乎不起作用。

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

或者

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

我将脚本另存为etc/init/VPN.conf

答案1

这是您的问题:

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)'

(2) 的意思是No such file or directory,即套接字不存在。

您实际安装了 MySQL 服务器吗?

sudo apt-get install mysql-server

你是否开始服务器?

sudo service mysql restart

答案2

为什么不把 (/bin/sleep 200 && /path/to/freeradius -X) 放入 /etc/rc.local 中?

http://wiki.ubuntuusers.de/rc.local

附言:睡眠功能耗时几秒钟。

相关内容