效果图如上:
实现思路,写个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
时间: 2024-10-01 02:19:04