rendered paste body#!/bin/sh
DB_DIR=/usr/local/mysql/data
PIDFILE=${DB_DIR}/`/bin/hostname -s`.pid
PROGNAME=mysqld
# Source function library
. /usr/local/etc/rc.d/functions
case "$1" in
start)
cd /usr/local/mysql
if [ -x /usr/local/mysql/bin/mysqld_safe ]; then
/usr/bin/limits -U mysql \
/usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=${DB_DIR} --pid-file=${PIDFILE} > /dev/null &
if [ $? -ne 0 ]
then
echo -e 'Starting mysqld:\t\t[ FAILED ]'
else
echo -e 'Starting mysqld:\t\t[ OK ]'
fi
fi
;;
stop)
if [ -f ${PIDFILE} ]; then
/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -e "Stopping mysqld:\t\t[ OK ]"
else
echo -e "Stopping mysqld:\t\t[ FAILED ]"
fi
;;
restart)
$0 stop
$0 start
;;
status)
status $PROGNAME
;;
*)
echo ""
echo "Usage: `basename $0` { start | stop | restart }"
echo ""
exit 64
;;
esac