packages/libs/mysql/files/mysqld.init
nico a05b905d05 packages/mysql: use new service functions
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29176 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-11-16 09:44:18 +00:00

31 lines
703 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2011 OpenWrt.org
START=95
STOP=10
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
SERVICE_STOP_TIME=9
error() {
echo "${initscript}:" "$@" 1>&2
}
start() {
local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)
if [ ! -d "$datadir" ]; then
error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist"
return 1
fi
if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then
error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables"
return 1
fi
service_start /usr/bin/mysqld
}
stop() {
service_stop /usr/bin/mysqld
}