3
回答
Redis 启动脚本
终于搞明白,存储TCO原来是这样算的>>>   
原版我也不知道出自哪里了.
#!/bin/sh
# chkconfig: 345 86 14
# description: Startup and shutdown script for Redis
REDIS_DIR=/web/redis/
#export $REDIS_DIR

REDIS_CONF=/etc/redis.conf
REDIS_PID=/var/run/redis.pid

case $1 in
    'start'|'s' )
        if test -x $REDIS_DIR/bin/redis-server
        then
            echo "Starting Redis..."
            if $REDIS_DIR/bin/redis-server $REDIS_CONF
            then
	        echo "OK"
            else
                echo "failed"
            fi
	else
	    echo "Couldn't find Redis Server ($REDIS_DIR/bin/redis-server)"
	fi
        ;;

    'stop' )
        echo "Stopping Redis..."
        kill `cat $REDIS_PID`
        ;;

    'restart'|'reload'|'r' )
        ${0} stop
        ${0} start
        ;;

    'list'|'l' )
        ps aux | egrep '(PID|redis-server)'
        ;;

    *)
echo "usage: `basename $0` {start|restart|reload|stop|list}"
esac


举报
G.
发帖于6年前 3回/1K+阅
顶部