PHP监控
#!/bin/bash# <a href="https://pdha.top/tag/Linux" title="更多关于 Linux 的文章" target="_blank">Linux</a>监控PHP服务,关闭就自动重启pgrep -x php-fpm &> /dev/nullif [ $? -ne 0 ];then/etc/init.d/php-fpm-56 restartecho "监控到php56已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/php_jiankong.logfi#!/bin/bash # <a href="https://pdha.top/tag/Linux" title="更多关于 Linux 的文章" target="_blank">Linux</a>监控PHP服务,关闭就自动重启 pgrep -x php-fpm &> /dev/null if [ $? -ne 0 ];then /etc/init.d/php-fpm-56 restart echo "监控到php56已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/php_jiankong.log fi#!/bin/bash # Linux监控PHP服务,关闭就自动重启 pgrep -x php-fpm &> /dev/null if [ $? -ne 0 ];then /etc/init.d/php-fpm-56 restart echo "监控到php56已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/php_jiankong.log fi
Redis监控
#!/bin/bash# Linux监控<a href="https://pdha.top/tag/redis" title="更多关于 redis 的文章" target="_blank">redis</a>服务,关闭就自动重启pgrep -x redis &> /dev/nullif [ $? -ne 0 ];then/etc/init.d/redis startfi#!/bin/bash # Linux监控<a href="https://pdha.top/tag/redis" title="更多关于 redis 的文章" target="_blank">redis</a>服务,关闭就自动重启 pgrep -x redis &> /dev/null if [ $? -ne 0 ];then /etc/init.d/redis start fi#!/bin/bash # Linux监控redis服务,关闭就自动重启 pgrep -x redis &> /dev/null if [ $? -ne 0 ];then /etc/init.d/redis start fi
MySQL监控
#!/bin/bash# Linux监控MySQL服务,关闭就自动重启pgrep -x mysqld &> /dev/nullif [ $? -ne 0 ];thenbash /www/server/panel/script/rememory.sh/etc/init.d/mysqld startecho "监控到MySQL已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/mysql_jiankong.logfi#!/bin/bash # Linux监控MySQL服务,关闭就自动重启 pgrep -x mysqld &> /dev/null if [ $? -ne 0 ];then bash /www/server/panel/script/rememory.sh /etc/init.d/mysqld start echo "监控到MySQL已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/mysql_jiankong.log fi#!/bin/bash # Linux监控MySQL服务,关闭就自动重启 pgrep -x mysqld &> /dev/null if [ $? -ne 0 ];then bash /www/server/panel/script/rememory.sh /etc/init.d/mysqld start echo "监控到MySQL已停止,已执行重启计划,时间: `date "+%Y-%m-%d %H:%M:%S"` " >> /www/mysql_jiankong.log fi
Nginx监控
#!/bin/bash# Linux监控Nginx服务,关闭就自动重启nginx_procnum=`ps -ef|grep "nginx"|grep -v grep|wc -l`if [ $nginx_procnum -eq 0 ]thenecho $(date) "Success,Nginx重启成功!" >> /var/log/nginxmonitor.log/etc/init.d/nginx startelsesleep 5echo "Nginx正常运行中..."fi#!/bin/bash # Linux监控Nginx服务,关闭就自动重启 nginx_procnum=`ps -ef|grep "nginx"|grep -v grep|wc -l` if [ $nginx_procnum -eq 0 ] then echo $(date) "Success,Nginx重启成功!" >> /var/log/nginxmonitor.log /etc/init.d/nginx start else sleep 5 echo "Nginx正常运行中..." fi#!/bin/bash # Linux监控Nginx服务,关闭就自动重启 nginx_procnum=`ps -ef|grep "nginx"|grep -v grep|wc -l` if [ $nginx_procnum -eq 0 ] then echo $(date) "Success,Nginx重启成功!" >> /var/log/nginxmonitor.log /etc/init.d/nginx start else sleep 5 echo "Nginx正常运行中..." fi
感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
暂无评论内容