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.

53 lines
1.2 KiB

  1. #!/bin/sh
  2. #
  3. # /Library/StartupItems/MySQLCOM/MySQLCOM
  4. #
  5. # A script to automatically start up MySQL on system bootup
  6. # for Mac OS X. This is actually just a wrapper script around
  7. # the standard mysql.server init script, which is included in
  8. # the binary distribution.
  9. #
  10. # (c) 2003 MySQL AB
  11. # Written by Lenz Grimmer <lenz@mysql.com>
  12. #
  13. # Suppress the annoying "$1: unbound variable" error when no option
  14. # was given
  15. if [ -z $1 ] ; then
  16. echo "Usage: $0 [start|stop|restart] "
  17. exit 1
  18. fi
  19. # Source the common setup functions for startup scripts
  20. test -r /etc/rc.common || exit 1
  21. . /etc/rc.common
  22. # The path to the mysql.server init script. The official MySQL
  23. # Mac OS X packages are being installed into /usr/local/mysql.
  24. SCRIPT="/usr/local/mysql/support-files/mysql.server"
  25. StartService ()
  26. {
  27. if [ "${MYSQLCOM:=-NO-}" = "-YES-" ] ; then
  28. ConsoleMessage "Starting MySQL database server"
  29. $SCRIPT start > /dev/null 2>&1
  30. fi
  31. }
  32. StopService ()
  33. {
  34. ConsoleMessage "Stopping MySQL database server"
  35. $SCRIPT stop > /dev/null 2>&1
  36. }
  37. RestartService ()
  38. {
  39. ConsoleMessage "Restarting MySQL database server"
  40. $SCRIPT restart > /dev/null 2>&1
  41. }
  42. if test -x $SCRIPT ; then
  43. RunService "$1"
  44. else
  45. ConsoleMessage "Could not find MySQL startup script!"
  46. fi