<form id="55n5d"></form>
    <form id="55n5d"></form> <noframes id="55n5d">

    <em id="55n5d"><address id="55n5d"></address></em>

        <form id="55n5d"></form>

        定時重啟mysql的方法

        Linux by 黃業興 at 2020-10-27

        1、編寫sh腳本語言

        #!/bin/sh
        pgrep -x mysqld &> /dev/null
        
        if [ $? -ne 0 ]
        
        then
        
        echo “At time: `date "+%Y%m%d_%H:%M:%S"` :MySQL?is stop .”>> 日志路徑
        
        /etc/init.d/mysqld start
        
        else
        
        echo “MySQL server is running: `date "+%Y%m%d_%H:%M:%S"` :Mysql is restart.”>> 日志路徑
        
        /etc/init.d/mysqld restart
        
        fi
        

        保存文件 name.sh

        2、加權限

        chmod -R777 name.sh

        嘗試運行一下腳本

        sh name.sh

        3、設置定時任務

        crontab -e

        我設置是晚上12點后重新啟動

        0  0  0 0 *  *  *  /name.sh > /dev/null 2>&1
        

        這樣就完成!

        請關注我們微信公眾號:mw748219


        永久免费看A片无码网站宅男

          <form id="55n5d"></form>
          <form id="55n5d"></form> <noframes id="55n5d">

          <em id="55n5d"><address id="55n5d"></address></em>

              <form id="55n5d"></form>