Skip to content

Instantly share code, notes, and snippets.

@bsolomon1124
Created March 7, 2019 00:02
Show Gist options
  • Select an option

  • Save bsolomon1124/cb6e6fd79b15543a74f105d5c9eb3aa8 to your computer and use it in GitHub Desktop.

Select an option

Save bsolomon1124/cb6e6fd79b15543a74f105d5c9eb3aa8 to your computer and use it in GitHub Desktop.
Redis quick setup on Mac OSX + Linux
#!/usr/bin/env sh
#
# Miniature version of redis/utils/install_server.sh
# compatible across OS X + Linux
if [ "$(id -u)" -ne 0 ]; then
echo "Must run as root"
exit 1
fi
REDIS_PORT=6379
REDIS_CONFIG_FILE="/etc/redis/$REDIS_PORT.conf"
REDIS_LOG_FILE="/var/log/redis_$REDIS_PORT.log"
REDIS_DATA_DIR="/var/lib/redis/$REDIS_PORT"
mkdir -p \
$(dirname "$REDIS_CONFIG_FILE") \
$(dirname "$REDIS_LOG_FILE") \
"$REDIS_DATA_DIR"
cat <<EOF > $REDIS_CONFIG_FILE
port 6379
daemonize yes
logfile $REDIS_LOG_FILE
dir $REDIS_DATA_DIR
EOF
echo "Success"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment