CentOS Boot from Boot Redis

Source: Internet
Author: User
Tags redis server

  • To modify redis.conf, open the background run option:
  • # By default, Redis does not run as a daemon. Use ' yes ' if you need it.# Note that Redis would write a PID file in/var/run/redis.pid when daemonized.daemonize Yes
  • Write a script that Vim/etc/init.d/redis:
    # chkconfig:2345 90# Description:start and Stop redis path=/usr/local/bin:/sbin:/usr/bin:/bin redisport=6379 #实际环境而定E Xec=/usr/local/redis/src/redis-server #实际环境而定REDIS_CLI =/usr/local/redis/src/redis-cli #实际环境而定 pidfile=/var/run/                redis.pidconf= "/usr/local/redis/redis.conf" #实际环境而定 case "$" in start) if [-F $PIDFILE]                Then echo "$PIDFILE exists, the 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 exists, process is not                Running. " Else pid=$ (cat $PIDFILE) echo "Stopping ..." $REDIS _cl I-p $Redisport SHUTDOWN While [-X $PIDFILE] do E                        Cho "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}" >&2 exit 1esac
  • Execute permissions:
    chmod +x/etc/init.d/redis
  • Boot from:
    # try to start or stop Redisservice Redis startservice redis Stop # Open service self-booting chkconfig Redis on

    source:http://my.oschina.net/indestiny/blog/197272

CentOS Boot from Boot Redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.