packages/libs/mysql/files/mysqld.init
florian 98120d9b4b [package] add mysql-server (#7384)
This is a patch to build the mysql server. So far I only have the
kirkwood target to test on, but it works great on that.

There seems to be some contention on whether Openwrt should have a
mysql-server package, but I don't see why it shouldn't at least have
the option. A full LAMP stack is now a reality.

Closes out https://dev.openwrt.org/ticket/7384

Again, I'm still pretty new to this, so any constructive criticism
would be appreciated.

Sorry for the attachment, but I wanted to make sure the whitespace and
lines got preserved.

Signed-off-by: Kyle Anderson <kyle@xkyle.com>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@22911 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-09-04 18:04:02 +00:00

34 lines
726 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2010 OpenWrt.org
START=95
STOP=10
PID=/var/run/mysqld.pid
CMD=/usr/bin/mysqld
start() {
DATADIR=`grep datadir /etc/my.cnf | cut -f 2 -d =`
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
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
else
start-stop-daemon -x $CMD -p $PID -b -m -S
fi
}
stop() {
echo -n "Stopping Mysqld..."
start-stop-daemon -x $CMD -p $PID -K
ret=$?
if [ -f "$PID" ]; then
rm "$PID"
fi
return ${ret}
}