zoukankan      html  css  js  c++  java
  • mysql开机脚本

    #!/bin/bash
    
    
    basedir=/home/app/db/mysql
    datadir=$basedir/data
    conf=$basedir/etc/my.cnf
    
    
    pid_file=$datadir/`/bin/hostname`.pid
    MYSQLD="$basedir/bin/mysqld_safe --defaults-file=$conf"
    
    usage(){
       echo "usage:"
       echo "  $0 start|stop|reload|status "
       exit 1
       }
    
    if test -z $1
      then
       usage
    fi
    
    STATUS=$pid_file
    
    case "$1" in
      "start")
        if test -s "$STATUS"
        then
          echo "The MySQL is running ..."
          echo $pid_file
        else
       
          sudo -u app -H $MYSQLD > /dev/null 2>&1 &
        fi
      ;;
      "stop")
        pid=`cat $pid_file`
        kill $pid > /dev/null 2>&1
        echo "The MySQL is stop ..."
      ;;
      "reload")
        pid=`cat $pid_file`
        kill -HUP $pid > /dev/null 2>&1
      ;;
      "status")
        if test -s "$STATUS"
          then
            echo "The MySQL is running..."
        else
            echo "The MySQL is down..."
        fi
      ;;
      *)
        usage
        exit 1
      ;;
    esac
    
    抄+改的
  • 相关阅读:
    452.用最少数量的箭引爆气球
    134.加油站
    Javascript
    spring-JDBC模板
    AOP注解方式ApsectJ开发
    AOP通知类型
    AOP的使用
    AOP相关术语
    AOP
    IOC注解详解
  • 原文地址:https://www.cnblogs.com/silenceli/p/3477670.html
Copyright © 2011-2022 走看看