redis-2.8.19.tar.gz 安裝和啟動指令碼

來源:互聯網
上載者:User

標籤:redis install

安裝部分:

#!/bin/bash

cd /usr/local/src
#wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
tar    zxvf  tcl8.6.1-src.tar.gz  -C  /usr/local/
cd     cd /usr/local/tcl8.6.1/unix/
./configure
make
make install

cd /usr/local/src
tar  zxvf redis-2.8.19.tar.gz
cd  redis-2.8.19
make
make install

mkdir  -p  /usr/local/redis/bin
mkdir  -p  /usr/local/redis/etc
mkdir  -p  /usr/local/redis/var
cd /usr/local/bin
cp  -pf  redis-server  /usr/local/redis/bin/
cp  -pf  redis-check-dump  /usr/local/redis/bin/
cp  -pf  redis-sentinel  /usr/local/redis/bin/
cp  -pf  redis-check-aof  /usr/local/redis/bin/
cp  -pf  redis-cli  /usr/local/redis/bin/
cp  -pf  /home/redis-2.8.19/redis.conf  /usr/local/redis/etc

touch  /etc/profile.d/redis.sh
cat  >  /etc/profile.d/redis.sh  <<  EOF
export  PATH=$PATH:/usr/local/redis/bin
EOF

mv  /usr/local/bin/redis-cli         /usr/local/bin/redis-cli.bak
mv  /usr/local/bin/redis-server      /usr/local/bin/redis-server.bak
mv  /usr/local/bin/redis-check-dump  /usr/local/bin/redis-check-dump.bak
mv  /usr/local/bin/check-aof         /usr/local/bin/check-aof.bak
mv  /usr/local/bin/tclsh8.6          /usr/local/bin/tclsh8.6.bak
mv  /usr/local/bin/benchmark         /usr/local/bin/benchmark.bak
mv  /usr/local/bin/redis-sentinel    /usr/local/bin/redis-sentinel.bak

啟動指令碼:

#!/bin/bash  
#
# chkconfig: 2345 90 10
# description: Redis  
# redis    Startup script for redis processes  
#  
# author: snowolf  
#  
# processname: redis  
 
redis_path="/usr/local/redis/bin/redis-server"  
redis_conf="/usr/local/redis/etc/redis.conf"  
redis_pid="/usr/local/redis/var/run/redis.pid"  
 
# Source function library.  
. /etc/rc.d/init.d/functions  
 
[ -x $redis_path ] || exit 0  
 
RETVAL=0  
prog="redis"  
 
 
# Start daemons.  
start() {  
    if [ -e $redis_pid -a ! -z $redis_pid ];then  
        echo $prog" already running...."  
        exit 1  
    fi  
 
    echo -n $"Starting $prog "  
    # Single instance for all caches  
    $redis_path $redis_conf  
    RETVAL=$?  
    [ $RETVAL -eq 0 ] && {  
        touch /var/lock/subsys/$prog  
        success $"$prog"  
    }  
    echo  
    return $RETVAL  
}  
 
 
# Stop daemons.  
stop() {  
    echo -n $"Stopping $prog "  
    killproc -d 10 $redis_path  
    echo  
    [ $RETVAL = 0 ] && rm -f $redis_pid /var/lock/subsys/$prog  
 
    RETVAL=$?  
    return $RETVAL  
}  
 
 
# See how we were called.  
case "$1" in  
        start)  
            start  
            ;;  
        stop)  
            stop  
            ;;  
        status)  
            status $prog  
            RETVAL=$?  
            ;;  
        restart)  
            stop  
            start  
            ;;  
        condrestart)  
            if test "x`pidof redis`" != x; then  
                stop  
                start  
            fi  
            ;;  
        *)  
            echo $"Usage: $0 {start|stop|status|restart|condrestart}"  
            exit 1  
esac  
exit $RETVAL 

本文出自 “常用文檔” 部落格,請務必保留此出處http://yujianglei.blog.51cto.com/7215578/1600805

redis-2.8.19.tar.gz 安裝和啟動指令碼

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.