技术文摘

帝国CMS在宝塔上面的MYSQL数据库经常自动停止或者掉线的解决方案

作者:凌木千雪   发表于:
浏览:17次    字数:742  原创
级别: 站内管理   总稿: 68 篇,  月稿: 0
帝国CMS在宝塔上面的MYSQL数据库经常自动停止或者掉线的解决方案。

1、MySQL监控
宝塔面板--->计划任务,输入任务名称、执行周期、脚本内容
脚本内容如下:
  1. pgrep -x mysqld &> /dev/null 
  2. if [ $? -ne 0 ];then 
  3. bash /www/server/panel/script/rememory.sh    
  4. /etc/init.d/mysqld start     
  5. echo "监控到MySQL已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/mysql_jiankong.log   
  6. fi 
2、Nginx监控
宝塔面板--->计划任务,输入任务名称、执行周期、脚本内容
脚本内容如下:
  1. pgrep -x nginx &> /dev/null 
  2. if [ $? -ne 0 ];then 
  3. /etc/init.d/nginx start   
  4. echo "监控到Nginx已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/Nginx_jiankong.log   
  5. fi 
3、PHP监控
宝塔面板--->计划任务,输入任务名称、执行周期、脚本内容
脚本内容如下:
  1. pgrep -x php-fpm &> /dev/null 
  2. if [ $? -ne 0 ];then 
  3. /etc/init.d/php-fpm-{52|53|54|55|56|70|71|73} restart 
  4. echo "监控到php已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/php_jiankong.log   
  5. fi 
4、redis监控
脚本内容如下:
  1. pgrep -x redis &> /dev/null 
  2. if [ $? -ne 0 ];then 
  3. /etc/init.d/redis start 
  4. fi 
5、memcached监控
脚本内容如下:
  1. pgrep -x memcached &> /dev/null 
  2. if [ $? -ne 0 ];then 
  3. /etc/init.d/memcached restart 
  4. fi 

【审核人:站长】

收藏   加好友   生成海报   分享
点赞(0)
打赏
Tags:
评论(0人参与,0条评论) 凌木千雪
0/0
  • 请先说点什么
    最新评论

    发布者资料

    热门文章

    技术文摘

    查看更多技术文摘
    首页
    栏目
    搜索
    会员
    投稿