Last active
August 29, 2015 14:22
-
-
Save funyx/4855abe32bcaf3d04bfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### 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 | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/bin/redis/src/redis-server | |
DAEMON_ARGS=/etc/redis/redis.conf | |
NAME=redis-server | |
DESC=redis-server | |
PIDFILE=/var/run/redis.pid | |
test -x $DAEMON || exit 0 | |
test -x $DAEMONBOOTSTRAP || exit 0 | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
touch $PIDFILE | |
chown redis:redis $PIDFILE | |
if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS | |
then | |
echo "$NAME." | |
else | |
echo "failed" | |
fi | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON | |
then | |
echo "$NAME." | |
else | |
echo "failed" | |
fi | |
rm -f $PIDFILE | |
;; | |
restart|force-reload) | |
${0} stop | |
${0} start | |
;; | |
*) | |
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daemonize yes | |
pidfile /var/run/redis.pid | |
logfile /var/log/redis.log | |
port 6379 | |
# bind 127.0.0.1 | |
# unixsocket /tmp/redis.sock | |
timeout 300 | |
loglevel verbose | |
databases 16 | |
save 900 1 | |
save 300 10 | |
save 60 10000 | |
rdbcompression yes | |
dbfilename dump.rdb | |
dir /var/redis/ | |
# requirepass foobared |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cd /usr/bin
wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
tar -xzf redis-2.6.13.tar.gz
cd redis-2.6.13
make install
adduser --system --no-create-home --disabled-login --disabled-password --group redis
touch /var/log/redis.log
chown redis:redis /var/log/redis.log
chmod u+w /var/log/redis.log
cd /etc/init.d/
"wget https://gist.githubusercontent.com/funyx/4855abe32bcaf3d04bfd/raw/6cdd0018c6642231730e8a58bdc49ef8829a5ac4/redis -O redis"
sudo chmod u+x redis
sudo update-rc.d -f redis defaults
sudo mkdir /var/redis
sudo chown redis:redis /var/redis
sudo chmod u+xw /var/redis
mkdir /etc/redis
"wget https://gist.github.com/funyx/4855abe32bcaf3d04bfd/raw/a928576dd7ff02cff7b26101110d8ab2727f9e15/redis.conf -O redis.conf"
chown redis:redis -R /etc/redis/
$ sudo service redis start
$ redis-cli