summaryrefslogtreecommitdiff
blob: a879024256504a72b9c42564b94a8ced0e30df89 (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
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.2 2002/10/28 07:15:32 woodchip Exp $

depend() {
	need net
}

checkconfig() {
	if [ ! -f /etc/mysql/my.cnf ] ; then
		eerror "No /etc/mysql/my.cnf file exists!"
	fi

	dir=`awk '{ if ( $0 ~ /^datadir[ \t]+=/ ) { print $3 } }' < /etc/mysql/my.cnf`

	if [ ! -d $dir/mysql ] ; then
		eerror "You dont appear to have the mysql database installed yet."
		eerror "Please run /usr/bin/mysql_install_db to have this done..."
		return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting mysqld"
	/usr/bin/safe_mysqld >/dev/null 2>&1 &
	eend $?
}

stop () {
	ebegin "Stopping mysqld"
	start-stop-daemon --stop --quiet \
		--pidfile=/var/run/mysqld/mysqld.pid --retry 20
	eend $?
}