packages/libs/mysql/files/mysqld.init
jow 54e6a20a2a [packages] mysql: fix initscript
git-svn-id: svn://svn.openwrt.org/openwrt/packages@24565 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-12-14 13:59:47 +00:00

28 lines
662 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 -b -S -- --pid-file=$PID
fi
}
stop() {
echo -n "Stopping Mysqld..."
service_kill ${CMD##*/} $PID
echo "done"
}