summaryrefslogtreecommitdiff
path: root/support-files/MacOSX/MySQLCOM
blob: ca5e444fddc07ca7c095e68abd5b20f84a446f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh

# Copyright (C) 2003, 2004 MySQL AB
# Use is subject to license terms
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1335  USA

#
# /Library/StartupItems/MySQLCOM/MySQLCOM
#
# A script to automatically start up MySQL on system bootup
# for Mac OS X. This is actually just a wrapper script around
# the standard mysql.server init script, which is included in
# the binary distribution.
#
# (c) 2003 MySQL AB
# Written by Lenz Grimmer <lenz@mysql.com>
#

# Suppress the annoying "$1: unbound variable" error when no option
# was given
if [ -z $1 ] ; then
	echo "Usage: $0 [start|stop|restart] "
	exit 1
fi

# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1
. /etc/rc.common

# The path to the mysql.server init script. The official MySQL
# Mac OS X packages are being installed into /usr/local/mysql.
SCRIPT="/usr/local/mysql/support-files/mysql.server"

StartService ()
{
	if [ "${MYSQLCOM:=-NO-}" = "-YES-" ] ; then
		ConsoleMessage "Starting MySQL database server"
		$SCRIPT start > /dev/null 2>&1
	fi
}

StopService ()
{
	ConsoleMessage "Stopping MySQL database server"
	$SCRIPT stop > /dev/null 2>&1
}

RestartService ()
{
	ConsoleMessage "Restarting MySQL database server"
	$SCRIPT restart > /dev/null 2>&1
}

if test -x $SCRIPT ; then
	RunService "$1"
else
	ConsoleMessage "Could not find MySQL startup script!"
fi