lizh 发表于 2018-11-3 10:14:25

Redis服务停止报错解决方案[NOAUTH Authentication required]

vi /etc/init.d/redis  
#!/bin/sh
  
# chkconfig: 2345 80 90
  
#
  
# Simple Redis init.d script conceived towork on Linux systems
  
# as it does use of the /proc filesystem.
  

  
REDISPORT=6389
  
EXEC=/usr/local/bin/redis-server
  
CLIEXEC=/usr/local/bin/redis-cli
  
RESDISPASSWORD=red29
  

  
PIDFILE=/var/run/redis_${REDISPORT}.pid
  
CONF="/etc/redis/${REDISPORT}.conf"
  

  
case "$1" in
  
   start)
  
       if [ -f $PIDFILE ]
  
       then
  
                echo "$PIDFILE exists,process is already running or crashed"
  
       else
  
                echo "Starting Redisserver..."
  
                $EXEC $CONF &
  
       fi
  
       ;;
  
   stop)
  
       if [ ! -f $PIDFILE ]
  
       then
  
                echo "$PIDFILE does notexist, process is not running"
  
       else
  
                PID=$(cat $PIDFILE)
  
                echo "Stopping ..."
  
                $CLIEXEC -a $RESDISPASSWORD -p$REDISPORT shutdown
  
                while [ -x /proc/${PID} ]
  
                do
  
                  echo "Waiting forRedis to shutdown ..."
  
                  sleep 1
  
                done
  
                echo "Redis stopped"
  
       fi
  
       ;;
  
   *)
  
       echo "Please use start or stop as first argument"
  
       ;;
  
esac


页: [1]
查看完整版本: Redis服务停止报错解决方案[NOAUTH Authentication required]