首页 > 其他 > 详细

开机启动redis

时间:2017-02-07 16:46:59      阅读:281      评论:0      收藏:0      [点我收藏+]

1、redis启动脚本

#!/bin/bash

#

#chkconfig: - 80 10

#description: start redis

#processname:redis


#=====================================================

#IPADDR=`/sbin/ifconfig eth1 |awk -F ‘:‘ ‘/inet addr/{print $2}‘ | sed ‘s/[a-zA-Z]//g‘`

BINFILE="/usr/local/bin/redis-server"

CONFFILE="/etc/redis.conf"


start(){

        stop

        sleep 1

        echo -n $"Starting redis.."

        $BINFILE $CONFFILE

        echo -e 

}


stop(){

        echo -n $"Shutting down redis..."

        /bin/kill -9 `/sbin/pidof redis-server`

        echo -e

}


restart(){

        stop

        sleep 1

        start

}


case "$1" in

start)

        start

        ;;

stop)

        stop

        ;;

restart)

        restart

        ;;

*)

        echo "Usage: $0 {start|stop|restart|condrestart|status}"

esac


2、把脚本放在/etc/init.d/目录下


3、设置开机启动,命令:chkconfig redis on


4、测试命令:

    service redis start

     ps -ef|grep redis

    service redis stop


开机启动redis

原文:http://332532.blog.51cto.com/322532/1895649

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!