Redis cluster _ 4. redis STARTUP script, redis_4.redis

Source: Internet
Author: User
Tags redis cluster

Redis cluster _ 4. redis STARTUP script, redis_4.redis


Redis STARTUP script:


# Vi/etc/init. d/redis
#!/usr/bin/env bash## redis start up the redis server daemon## chkconfig: 345 99 99# description: redis service in /etc/init.d/redis \#             chkconfig --add redis or chkconfig --list redis \#             service redis start  or  service redis stop# processname: redis-server# config: /main/redis/redis.confPATH=/usr/local/bin:/sbin:/usr/bin:/binREDISPORT=6379EXEC=/main/redis/src/redis-serverREDIS_CLI=/main/redis/src/redis-cliPIDFILE=/var/run/redis.pidCONF="/main/redis/redis.conf"#make sure some dir exist#if [ ! -d /var/lib/redis ] ;then#    mkdir -p /var/lib/redis#    mkdir -p /var/log/redis#ficase "$1" in    status)        ps -A|grep redis        ;;    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 ..."                    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


Set automatic redis startup

# Chkconfig -- add redis
# Chkconfig -- list redis
# Service redis start

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.