Watch Star Fork

茹憶。 / LepusPython

加入码云
与超过 300 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
简洁、直观、强大的开源企业级数据库监控系统,MySQL/Oracle/MongoDB/Redis一站式监控,让数据库监控更简单。支持邮件告警、短信告警、AWR性能报告、慢查询分析等专业功能。 http://www.oschina.net/p/lepus
一键复制 编辑 原始数据 按行查看 历史
lepus 1.67 KB ruzuojun 提交于 2017-08-07 15:36 . 代码目录调整,修改readme
#!/bin/bash
basedir="/usr/local/lepus"
#check basedir
#############################################################################
if test -z "$basedir"
then
basedir=/usr/local/lepus
else
basedir="$basedir"
fi
arg=$1
lepus_process=`ps -ef|grep lepus.py |grep -v grep|wc -l`
case "$arg" in
'status')
#check lepus status
if [ $lepus_process -ge "2" ];then
echo "lepus server is running..."
else
echo "lepus server is not run!"
fi
;;
'start')
#start lepus
if [ $lepus_process -ge "2" ];then
echo " lepus server is already run!"
else
cd $basedir && nohup python lepus.py &> logs/lepus.log&
sleep 5
lepus_process=`ps -ef|grep lepus.py |grep -v grep|wc -l`
if [ $lepus_process -ge "2" ];then
echo "lepus server start success!"
else
echo "lepus server start fail!"
fi
fi
;;
'stop')
#stop lepus
if [ $lepus_process -le "2" ];then
echo "lepus server is not running!"
else
ps -ef |grep -i -E "lepus.py"|grep -v -E "vi|grep"|awk '{print $2}' |while read line; do kill $line; echo "lepus processes id $line been stop"; done
#killall python lepus.py*
fi
;;
'--help')
#for help
echo "lepus help:"
echo "support-site: www.lepus.cc"
echo "===================================================================="
echo "start Start lepus monitor server; Command: #lepus start"
echo "stop Stop lepus monitor server; Command: #lepus stop"
echo "status Check lepus monitor run status; Command: #lepus status"
;;
*)
echo "Please input --help to read the help info."
;;
esac
exit 0

评论 ( 0 )

你可以在登录后,发表评论

搜索帮助