The code is as follows:
# Chkconfig:234590 10# Description:service of Redis for start and stop add by Tomener PATH=/usr/local/bin:/sbin:/usr/bin:/Binredisport=6379EXEC=/usr/local/redis/bin/redis-serverredis_cli=/usr/local/redis/bin/redis-CLI Pidfile=/var/run/redis.pid CONF="/usr/local/redis/redis.conf"AUTH="1234" Case " $" inchstart)if[ -F $PIDFILE] Then Echo "$PIDFILE exists, process is already running or crashed." Else Echo "starting Redis Server ..."$EXEC $CONFfi if["$?"="0" ] Then Echo "Redis is running ..." fi ;; Stop)if[ ! -F $PIDFILE] Then Echo "$PIDFILE exists, process is not running." ElsePID=$(Cat$PIDFILE)Echo "stopping ..."$REDIS _cli-P $REDISPORT SHUTDOWNSleep 2 while[ -x $PIDFILE] Do Echo "waiting for Redis to shutdown ..." Sleep 1 Done Echo "Redis stopped" fi ;; Restart|force-Reload) ${0} stop ${0} start; *) Echo "Usage:/etc/init.d/redis {start|stop|restart|force-reload}">&2Exit1 Esac
Redis Service startup Shutdown script