标签:roc echo .com netstat pre 进程 服务 class ima
效果图如上:
实现思路,写个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
标签:roc echo .com netstat pre 进程 服务 class ima
原文地址:http://www.cnblogs.com/spectrelb/p/7484594.html