#!/bin/bash

redis_dir="/usr/local/redis"
redis_conf="/usr/local/redis/redis.conf"
time=`date`
log="/tmp/redis.log"

rediss=`ps -ef|grep -v vim |grep -v grep |grep redis-server|grep 6379|wc -l`
if [ ${rediss} -eq 0 ];then
  ${redis_dir}/bin/redis-server ${redis_conf}
  echo "${time}-->redis has shutdown,now it startup." >> ${log}
  exit 1
fi

echo "${time}-->redis is running" >> ${log}

log_count=`cat $log |wc -l`
if [ $log_count -gt 5000 ];then
  sed -i '1,1000d' $log
fi

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-08
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
相关资源
相似解决方案