Writing Redis Startup scripts
[Email protected] etc]# Vi/etc/init.d/redis
[Email protected] etc]# chmod 755/etc/init.d/redis
# ##########################
#chkconfig: 2345 10 90#description: start and stop redispath=/usr/local/bin :/sbin:/usr/bin:/bin redisport=6379exec=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/ redis-cli pidfile=/var/run/redis.pidconf= "/etc/redis.conf" case "$" in start) if [ -f $ pidfile ] then echo "$PIDFILE exists, process is already running or crashed "else echo "Starting redis server ..." $EXEC $CONF fi if [ "$?" = "0" ] then echo "Redis is running ..." fi ;; stop) if [ ! -f $ pidfile ] then echo "$PIDFILE does not exist, Process is not running "else pid=$ (cat $PIDFILE) echo "stopping ", $REDIS _cli -p $REDISPORT shutdown while [ -x ${pidfile} ] do echo "waiting for redis TO SHUTDOWN&NBSP: " 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} " >&2 exit 1esac################# #############
This article is from "think one or two" blog, please be sure to keep this source http://250919938.blog.51cto.com/962010/1685632
Redis Startup scripts