From: jow Date: Tue, 14 Dec 2010 14:12:15 +0000 (+0000) Subject: [packages] mysql: further init script cleanup X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=8b9df09d234db063fca07fa02e5142ad9ec14dd1;p=packages.git [packages] mysql: further init script cleanup git-svn-id: svn://svn.openwrt.org/openwrt/packages@24567 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/libs/mysql/files/mysqld.init b/libs/mysql/files/mysqld.init index e3088a342..32fe7b214 100644 --- a/libs/mysql/files/mysqld.init +++ b/libs/mysql/files/mysqld.init @@ -1,27 +1,29 @@ #!/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 + local datadir=$(sed -n -e 's/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*//p' /etc/my.cnf) + 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 + else + echo -n "Starting MySQL daemon... " start-stop-daemon -x $CMD -b -S -- --pid-file=$PID - fi + echo "done" + fi } stop() { - echo -n "Stopping Mysqld..." - service_kill ${CMD##*/} $PID - echo "done" + echo -n "Stopping MySQL daemon... " + service_kill ${CMD##*/} $PID + echo "done" }