MySQL multi-instance Stop script

Source: Internet
Author: User
Tags stop script

#!/bin/bash

port=3306

Basedir=/application/mysql

datadir=/data/$port/data

pidfile=/data/$port/mysql.pid

sock=/data/$port/mysql.sock

bindir= $basedir/bin

Status=$1

USAGE () {

echo "Usage:/data/$port/mysql {Start|stop|restart}"

}

Start () {

if [!-F $sock]

Then

Echo $echo _n "Starting MySQL"

Else

echo "ERROR: $sock exists you can remove"

Fi

}

Stop () {

Mysqld_pid= ' Cat $pidfile '

echo "Shutting down MySQL"

if (kill-0 $mysqld _pid 2>/dev/null)

Then

Kill $mysqld _pid

Fi

}

#restart () {

# stop

# Sleep 5

# start

#}

Main () {

Case $STATUS in

Start

Start

;;

Stop

Stop

;;

Restart

Stop

Sleep 5

Start

;;

*)

USAGE

Esac

}

Main


This article is from my study blog, so be sure to keep this source http://shuai12138.blog.51cto.com/10118203/1919871

MySQL multi-instance Stop script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.