liblo: moved to github
[openwrt.org/packages.git] / libs / mysqld.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2010-2011 OpenWrt.org
3
4 START=95
5 STOP=10
6
7 SERVICE_DAEMONIZE=1
8 SERVICE_WRITE_PID=1
9 SERVICE_STOP_TIME=9
10
11 error() {
12 echo "${initscript}:" "$@" 1>&2
13 }
14
15 start() {
16 local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)
17 if [ ! -d "$datadir" ]; then
18 error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist"
19 return 1
20 fi
21 if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then
22 error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables"
23 return 1
24 fi
25 service_start /usr/bin/mysqld
26 }
27
28 stop() {
29 service_stop /usr/bin/mysqld
30 }
31
comments