检测服务器上的服务是否正常

效果图如上:

实现思路,写个shell脚本,然后php 

  $redis     = exec('sh /usr/shell/check_redis.sh');

  去执行:

通过端口和进程来判断,脚本实现:

#!/bin/sh
port=`netstat -nlt|grep 6379|wc -l`
process=`ps -ef |grep redis|grep -v grep |wc -l`
if [ $port -ge 1 ] && [ $process -ge 1 ]
then
    echo  `date '+%Y-%m-%d %H:%M:%S'@`200
else
    echo `date '+%Y-%m-%d %H:%M:%S'@`"6379 Port is close or The Redis process does not exist"
fi

  

 

相关文章:

  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-11-20
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-06-13
  • 2021-06-18
相关资源
相似解决方案