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

  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. PROG='/usr/bin/mysqld'
  9. start() {
  10. local conf='/etc/my.cnf'
  11. local datadir="$( sed -nE "s/^\s*datadir\s*=\s*('([^']*)'|\x22([^\x22]*)\x22|(.*\S))\s*$/\2\3\4/p" "$conf" )"
  12. [ -d "$datadir" ] || {
  13. logger -s "[ERROR] datadir '$datadir' in '$conf' does not exist"
  14. return 1
  15. }
  16. [ -f "$datadir/mysql/tables_priv.MYD" ] || {
  17. logger -s "[ERROR] can not detect privileges table, you might need to"
  18. logger -s "run 'mysql_install_db --force' to initialize the system tables"
  19. return 1
  20. }
  21. service_start "$PROG"
  22. }
  23. stop() {
  24. service_stop "$PROG"
  25. }