系統環境redis
操做系統:Ubuntu 16.04.4 LTS redis版本:4.0.11
編譯安裝Redisshell
https://redis.io/download
# tar -zxvf redis-VERSION.tar.gz # cd redis-VERSION # make PREFIX=/usr/local/redis install
# mkdir /usr/local/redis/{etc,run}
# cp redis.conf /usr/local/redis/etc/
logfile /XXX/XXX dir /XXX/XXX
# vim /etc/init.d/redis #!/bin/bash # ### BEGIN INIT INFO # Provides: redis-server # Required-Start: $syslog # Required-Stop: $syslog # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: redis-server - Persistent key-value db # Description: redis-server - Persistent key-value db ### END INIT INFO BIN="/usr/local/redis/bin" CONFIG="/usr/local/redis/etc/redis.conf" PIDFILE="/usr/local/redis/run/redis.pid" ### Read configuration test -x $DAEMON || exit 0 test -x $DAEMONBOOTSTRAP || exit 0 set -e [ -r "$SYSCONFIG" ] && source "$SYSCONFIG" RETVAL=0 prog="redis-server" desc="Redis Server" start() { if [ -e $PIDFILE ] ;then echo "$desc already running...." exit 1 fi echo -n $"Starting $desc: " $BIN/$prog $CONFIG & RETVAL=$? echo [ $RETVAL -eq 0 ] && echo "$CONFIG OK" return $RETVAL } stop() { echo -n $"Stop $desc: " pkill -9 $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $PIDFILE return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; condrestart) [ -e /var/lock/subsys/$prog ] && restart RETVAL=$? ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" RETVAL=1 esac exit $RETVAL
# /etc/init.d/redis start