redis开机启动脚本
redis.conf
daemonize yes pidfile /usr/local/redis/var/redis.pid port 6379 timeout 300 loglevel notice logfile /usr/local/redis/var/redis.log databases 16 save 900 1 save 300 10 save 60 10000 rdbcompression yes dbfilename dump.rdb dir /usr/local/redis/var/ #8g memory 8*1024*1024*1024 maxmemory 8589934592 appendonly no
redis开机启动脚本
#!/bin/bash # # init file for redis # # chkconfig: - 80 12 # description: redis daemon # # processname: redis # config: /usr/local/redis/redis.conf # pidfile: /usr/local/redis/var/redis.pid source /etc/init.d/functions REDISPORT=6379 EXEC=/usr/local/redis/redis-server REDIS_CLI=/usr/local/redis/redis-cli PIDFILE=/usr/local/redis/var/redis.pid CONF="/usr/local/redis/redis.conf" case "$1" in 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|reload) ${0} stop ${0} start ;; *) echo "Usage: /etc/init.d/redis {start|stop|restart|reload}" >&2 exit 1 esac