#!/sbin/sh
#
# $NetBSD$
#
# Init script for mysqld.
#

. /lib/svc/share/smf_include.sh

PIDFILE="/var/mysql/mysql.pid"

ulimit -n 10240

case "$1" in
start)
	/opt/local/sbin/mysqld --user=mysql \
		--basedir=/opt/local \
		--datadir=/var/mysql \
		--pid-file=${PIDFILE} \
		--log-error=/var/log/mysql/error.log &
	;;
stop)
	[ -f ${PIDFILE} ] && kill `/usr/bin/head -1 ${PIDFILE}`
	;;
*)
	echo "Usage: $0 {start|stop}" >&2
	exit 1
	;;
esac

exit $SMF_EXIT_OK
