hx0011yy 发表于 2018-11-4 11:23:04

Redis单机版安装

#!/bin/sh  
#
  
# Simple Redis init.d script conceived towork on Linux systems
  
# as it does use of the /proc filesystem.
  

  
REDISPORT=6379
  
EXEC=/usr/local/redis/bin/redis-server
  
CLIEXEC=/usr/local/redis/bin/redis-cli
  

  
PIDFILE=/usr/local/redis/pid/redis_${REDISPORT}.pid
  
CONF="/usr/local/redis/conf/${REDISPORT}.conf"
  

  
case "$1" in
  
   start)
  
       if [ -f $PIDFILE ]
  
       then
  
                echo "$PIDFILE exists, processis 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 -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单机版安装