美文网首页
check memcached process and rest

check memcached process and rest

作者: 9682f4e55d71 | 来源:发表于2018-03-08 09:50 被阅读15次
    #!/bin/sh
    #check memcached process and restart if down
    PATH=$PATH:/usr/bin/memcached
    DATE=`date -d "today" +"%Y-%m-%d-%H:%M"`
    #用ps命令查看memcached进程
    MM=`ps -aux |grep "memcached" |grep "13250" |grep -v "grep" |wc -l`
    #if语句判断进程是否存在,如果不存在,输出日志记录并重启memcached服务
    if [ "$MM" == "0" ]; then
        echo "$DATE The memcached is problem and restart" >> /tmp/memcached_check.logs
        /usr/bin/memcached -m 1024 -p 13250 -d -u nobody
    else
        echo "$DATE The memcached is ok" >>/tmp/memcached_check.logs
    fi
    

    相关文章

      网友评论

          本文标题:check memcached process and rest

          本文链接:https://www.haomeiwen.com/subject/iqvefftx.html