#!/bin/bash port="27017" start=”nohup /usr/bin/monGod --config /etc/mongod.conf&nb
#!/bin/bash
port="27017"
start=”nohup /usr/bin/monGod --config /etc/mongod.conf & ”
EMaiL=”/bin/echo mongoDB | mutt -s "重新启动mongodb" 516249940@qq.com”
netstat -ln |awk '/^tcp/{print $4}'|grep -q ":$port$"|| {
#restart mongodb
eval $start;
#$EMAIL
exit $?
}
exit 0
之前的mongo从库没有nohup启动,从有时候会自动挂掉,写这个脚本是为了,过一段时间让他自动起来··
--结束END--
本文标题: shell检查mongodb端口是否存在
本文链接: https://www.lsjlt.com/news/41429.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-16
2024-03-15
2024-03-15
2024-03-15
2024-03-15
2024-03-15
2024-03-15
2024-03-15
2024-03-15
2024-03-14
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0