Redis Startup Management Scripts

Source: Internet
Author: User

Easy-to-use Redis startup management scripts that need to be adapted to the Redis-related files you install

I am the source of the installation of redis-3.0.5

Installation path/usr/local/redis

To edit the Create script file:

Vim/etc/init.d/redis

#!/bin/sh## chkconfig:   2345 85 15  # description: this  script can manager the redis-server daemon#               Redis is a persistent key-value  database# exec:        /usr/local/redis/bin/redis-server#  config:      /usr/local/redis/conf/redis.conf  # pidfile:      /usr/local/redis/logs/redis.pid  # datafile:    / usr/local/redis/data/redis.rdb  redis= "/usr/local/redis/bin/redis-server" REDIS_CONF_FILE= "/usr/local /redis/conf/redis.conf "prog=$ (basename  $redis) lockfile=/var/lock/subsys/redis# source function  library.  /etc/rc.d/init.d/functions # source networking configuration.  /etc/sysconfig/network  # check that networking is up. [  "$NETWORKING"  =  "No"  ] && exit 0 start ()  {     [ -x  $redis  ] | |  exit 5    [ -f  $REDIS _conf_file ] | |  exit 6    echo -n $ "starting  $prog: "      daemon  $redis   $REDIS _conf_file    retval=$?    echo     [  $retval  -eq 0 ] && touch  $lockfile      return  $retval}stop ()  {    echo -n $ "stopping $ prog:  "    killproc  $prog  -QUIT    retval=$?     echo    [  $retval  -EQ 0 ] && RM  -f  $lockfile     RETURN  $retval}restart ()  {    stop    start}reload ()  {     echo -n $ "reloading  $prog: "     killproc  $redis  -hup    retval=$?    echo}rh_status ()  {     status  $prog}rh_status_q ()  {    rh_status >/dev/null 2> &1}case  "$"  in    start)         rh_ status_q && exit 0        $1         ;;     stop)         rh_status_q | |  exit 0        $1         ;;     restart)         $1        ;;     reload)         rh_status_q | |  exit 7        $1         ;;     status)         rh_status         ;;     *)         echo $ "Usage: $0 { Start|stop|restart|reload|status} "        exit 2esac

Modify script action permissions, add executable permissions

chmod 755/etc/init.d/redis

##### END #####

This article is from the "Qin Notes" blog, please be sure to keep this source http://ciqin.blog.51cto.com/10608412/1794671

Redis Startup Management Scripts

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.