You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
690 B

#!/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
PROG='/usr/bin/mysqld'
start() {
local conf='/etc/my.cnf'
local datadir="$( sed -nE "s/^\s*datadir\s*=\s*('([^']*)'|\x22([^\x22]*)\x22|(.*\S))\s*$/\2\3\4/p" "$conf" )"
[ -d "$datadir" ] || {
logger -s "[ERROR] datadir '$datadir' in '$conf' does not exist"
return 1
}
[ -f "$datadir/mysql/tables_priv.MYD" ] || {
logger -s "[ERROR] can not detect privileges table, you might need to"
logger -s "run 'mysql_install_db --force' to initialize the system tables"
return 1
}
service_start "$PROG"
}
stop() {
service_stop "$PROG"
}