代码拉取完成,页面将自动刷新
同步操作将从 茹憶/MySQLMTOP 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
basedir=""
#check system,This script must be run on CentOS/RHEL only.
############################################################################
if [ ! -f /etc/redhat-release ]; then
echo "[ERROR]: Sorry, this script is for CentOS/RHEL only."
exit 1
fi
#check basedir
#############################################################################
if test -z "$basedir"
then
basedir=/usr/local/mysqlmtop
else
basedir="$basedir"
fi
arg=$1
mtop_process=`ps -ef|grep mtop |grep -v grep|wc -l`
case "$arg" in
'status')
#check mtop status
if [ $mtop_process -ge "5" ];then
echo "mysql mtop is run!"
else
echo "mysql mtop is not run!"
fi
;;
'start')
#start mtop
if [ $mtop_process -ge "5" ];then
echo "mysql mtop is already run!"
else
cd $basedir && nohup ./mtopd.py & > /dev/null 2>&1
sleep 1
mtop_process=`ps -ef|grep mtop |grep -v grep|wc -l`
if [ $mtop_process -ge "5" ];then
echo "mysql mtop start success!"
else
echo "mysql mtop start fail!"
fi
fi
;;
'stop')
#stop mtop
if [ $mtop_process -le "5" ];then
echo "mysql mtop is not run..."
else
ps -ef |grep -i -E "mtopctl|mtopd.py"|grep -v -E "vi|grep"|awk '{print $2}' |while read line; do kill $line; echo "mtop processes id $line been stop"; done
fi
;;
'--help')
#for help
echo "mysql mtop help:"
echo "support-site:www.mtop.cc www.ruzuojun.com"
echo "===================================================================="
echo "start Start mysql mtop monitor server; Command: #mtopctl start"
echo "stop Stop mysql mtop monitor server; Command: #mtopctl stop"
echo "status Check mysql mtop monitor run status; Command: #mtopctl status"
;;
*)
echo "Please input --help to read the help info."
;;
esac
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。