2010-09-04 18:04:02 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2010 OpenWrt.org
|
2010-12-14 14:12:15 +00:00
|
|
|
|
2010-09-04 18:04:02 +00:00
|
|
|
START=95
|
|
|
|
STOP=10
|
|
|
|
|
|
|
|
PID=/var/run/mysqld.pid
|
|
|
|
CMD=/usr/bin/mysqld
|
|
|
|
|
|
|
|
start() {
|
2011-01-29 18:51:47 +00:00
|
|
|
local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)
|
2010-12-14 14:12:15 +00:00
|
|
|
if [ ! -d "$datadir" ]; then
|
|
|
|
echo "Error: datadir in /etc/my.cnf ($datadir) doesn't exist"
|
|
|
|
return 1
|
|
|
|
elif [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then
|
2010-12-14 13:59:47 +00:00
|
|
|
echo "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables"
|
|
|
|
return 1
|
2010-12-14 14:12:15 +00:00
|
|
|
else
|
|
|
|
echo -n "Starting MySQL daemon... "
|
2010-12-14 13:59:47 +00:00
|
|
|
start-stop-daemon -x $CMD -b -S -- --pid-file=$PID
|
2010-12-14 14:12:15 +00:00
|
|
|
echo "done"
|
|
|
|
fi
|
2010-09-04 18:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2010-12-14 14:12:15 +00:00
|
|
|
echo -n "Stopping MySQL daemon... "
|
|
|
|
service_kill ${CMD##*/} $PID
|
|
|
|
echo "done"
|
2010-09-04 18:04:02 +00:00
|
|
|
}
|