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.

30 lines
716 B

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