1.mysql-server.sh.in 1.56 KB
Newer Older
1
#!/bin/sh
2 3 4
#
# This is the version for ops. My apologies for the naming sillyness.
#
5

6 7 8 9 10
# PROVIDE: mysql
# REQUIRE: NETWORKING SERVERS mysql-client
# BEFORE: DAEMON
# KEYWORD: shutdown

11 12 13 14
version=`/usr/local/bin/mysql_config --version`;
majmin=${version%.*}
major=${majmin%%.*}
minor=${majmin##*.}
15

16 17 18 19 20 21
opts="-O long_query_time=2 -O max_connections=300 -O key_buffer=32M"
opts="$opts -O table_cache=256 -O sort_buffer=4M -O record_buffer=1M"

logopt="--log-long-format --log=@prefix@/log/mysql/base --log-slow-queries=@prefix@/log/mysql/slowqueries"

if [ $major -eq 5 ]; then
22
	safeprog=/usr/local/bin/mysqld_safe
23 24 25 26 27 28 29 30 31 32
	if [ $minor -gt 1 ]; then
	    logopt="--general_log=1 --general_log_file=@prefix@/log/mysql/base"
	    logopt="$logopt --slow_query_log=1 --slow_query_log_file=@prefix@/log/mysql/slowqueries"

	    # XXX awkward: no -O, a couple of name changes
	    opts="--default-storage-engine=MyISAM --long_query_time=2"
	    opts="$opts --max_connections=300 --key_buffer=32M"
	    opts="$opts --table_open_cache=256 --sort_buffer=4M"
	    opts="$opts --read_buffer_size=1M"
	fi
33 34 35 36
else
	safeprog=/usr/local/bin/safe_mysqld
fi

37 38
logopt="$logopt --log-bin=@prefix@/log/mysql/update"

39
case "$1" in
40
	start|faststart|quietstart|onestart|forcestart)
41
		if [ -x $safeprog ]; then
42
			$safeprog --pid-file=/var/db/mysql/mysqld.pid --user=mysql $opts $logopt > /dev/null 2>&1 &
43 44 45
			echo -n ' mysqld'
		fi
		;;
46
	stop|faststop|quietstop|onestop|forcestop)
47 48 49 50 51 52 53 54 55 56 57 58 59 60
		/usr/bin/killall mysqld > /dev/null 2>&1 && echo -n ' mysqld'
		;;
	*)
		echo ""
		echo "Usage: `basename $0` { start | stop }"
		echo ""
		exit 64
		;;
esac