#!/bin/sh# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB# This file is public domain and comes with NO WARRANTY of any kind

# MySQL daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.# When this is done the mysql server will be started when the machine is# started and shut down when the systems goes down.

# If you install MySQL on some other places than /opt/mysql5.6, then you# have to do one of the following things for this script to work:## - Run this script from within the MySQL installation directory# - Create a /etc/my.cnf file with the following information:# [mysqld]# basedir=<path-to-mysql-installation-directory># - Add the above to any other configuration file (for example ~/.my.ini)# and copy my_print_defaults to /usr/bin# - Add the path to the mysql-installation-directory to the basedir variable# below.## If you want to affect other MySQL variables, you should make your changes# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

# If you change base dir, you must also change datadir. These may get# overwritten by settings in the MySQL configuration files.

other_args="$*"# uncommon, but needed when called from an RPM upgrade action# Expected: "--skip-networking --skip-grant-tables"# They are not checked here, intentionally, as it is the resposibility# of the "spec" file author to give correct arguments only.

# if server isn't running, then pid-file will never be updatedif test -n "$pid"; thenif kill -0 "$pid" 2>/dev/null; then : # the server still runselse# The server may have exited between the last pid-file check and now.if test -n "$avoid_race_condition"; thenavoid_race_condition=""continue# Check again.fi

# there's nothing that will affect the file. log_failure_msg "The server quit without updating PID file ($pid_file_path)."return 1 # not waiting any more.fifi

'restart')# Stop the service and regardless of whether it was# running or not, start it again.if $0 stop $other_args; then $0 start $other_argselse log_failure_msg "Failed to stop running server, so refusing to try to start."exit 1fi ;;