#!/bin/sh # # mysql A very fast and reliable SQL database engine # # chkconfig: 2345 90 90 # # description: A very fast and reliable SQL database engine. # # pidfile: /var/state/mysql/mysqld.pid # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql # Check that networking is up. if [ "${NETWORKING}" = "no" ]; then echo "WARNING: Networking is down. Mysql service can't be runed." exit 1 fi case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/mysql ]; then show Starting mysql busy su mysql -c '/usr/sbin/mysqld > /dev/null &' touch /var/lock/subsys/mysql deltext ok else echo "Mysql already is running" fi touch /var/lock/subsys/mysql ;; stop) show Stopping mysql service killproc mysqld sleep 2 rm -f /var/state/mysql/mysqld.pid rm -f /var/lock/subsys/mysql ;; status) status mysqld ;; restart|reload) $0 stop $0 start ;; *) echo "Usage: mysql {start|stop|status|restart|reload}" exit 1 ;; esac