Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3ee380ec21
Fetching contributors…

Cannot retrieve contributors at this time

file 87 lines (75 sloc) 2.589 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
#!/usr/bin/env bash

set -o errtrace
export PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }'

log() { printf "$*\n" ; return $? ; }
fail() { log "\nERROR: $*\n" ; exit 1 ; }

if [[ ${debug_flag:-0} -eq 1 ]] ; then
  set -o verbose
fi

if [[ ${trace_flag:-0} -eq 1 ]] ; then
  set -o xtrace
fi

files=( "/etc/.bdsmrc" "$HOME/.bdsmrc" )
for file in "${files[@]}" ; do
  [[ -s "$file" ]] && source "$file"
done

export PATH="/sbin:/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local:sbin:$PATH"

if [[ $UID -eq 0 ]] ; then
  if [[ -d /etc/init.d ]] ; then
    init_scripts_path=/etc/init.d
  elif [[ -d /etc/rc.d ]] ; then
    init_scripts_path=/etc/rc.d
  else
    printf "ERROR: Unknown init scripts directory (neither /etc/init.d nor /etc/rc.d were found).\n"
    exit 1
  fi
else
  true ${init_scripts_path:="$HOME/bin"}
fi

package="redis"
true ${version:="2.2.2"}
true ${archive_format:="tar.gz"}
package_file="${package}-${version}.${archive_format}"
true ${redis_url:="http://redis.googlecode.com/files/${package_file}"}
result=0

if [[ $UID -eq 0 ]] ; then
  prefix="${prefix:-/usr/local}"
  directories=(/etc/redis /var/log/redis /var/run/redis /data/redis)
  redis_user="redis"
else
  prefix="${prefix:-$HOME}"
  redis_install_path="$prefix"
  directories=("$HOME/.redis/log" "$HOME/.redis/data" "$HOME/.redis/pids")
  redis_user="$USER"
fi
true ${src_path:="$prefix/src"}

# Redis Configuration.
true ${redis_port:=6379}
true ${redis_bind_interface:="127.0.0.1"}
true ${redis_src_path:="${src_path}/${package}-${version}"}
true ${redis_install_path:="$prefix"}
true ${redis_bin_path:="${redis_install_path}/bin"}
true ${redis_config_path:="/etc/redis"}
true ${redis_config_file:="${redis_config_path}/redis.conf"}
true ${redis_servers_path:="$redis_etc_path/servers"}
true ${redis_log_path:="/var/log/redis"}
true ${redis_log_file:="/var/log/redis/redis.log"}
true ${redis_server_binary:="${redis_bin_path}/redis-server"}
true ${redis_cli_binary:="${redis_bin_path}/redis-cli"}
true ${redis_pid_path:="/var/run/redis"}
true ${redis_pid_file:="${redis_pid_path}/redis.pid"}
true ${redis_db_path:="/var/db/redis"}
true ${redis_db_file:="${redis_db_path}/dump.rdb"}
true ${redis_lock_path:="/var/lock/redis"}
true ${redis_lock_file:="${redis_lock_path}/redis.lock"}

redis_paths=(
  "${redis_bin_path}"
  "${redis_config_path}"
  "${redis_pid_path}"
  "${redis_db_path}"
  "${redis_lock_path}"
  "${redis_servers_path}"
  "${redis_log_path}"
)

timestamp=$(date +%m.%d.%YT%H:%M:%S)
redis_master_pid="$(ps auxww | awk "/[r]edis-server /{print \$2}" | head -1)"
Something went wrong with that request. Please try again.