Permalink
Browse files

Removed old template.

  • Loading branch information...
1 parent 9330a5e commit 184f92efb94a79f00216ea9984bba0440ee05e44 @wayneeseguin wayneeseguin committed Oct 20, 2011
Showing with 0 additions and 136 deletions.
  1. +0 −136 redis/templates/redis.template
@@ -1,136 +0,0 @@
-#!/bin/sh
-
-log() { printf "$*\n" ; return $? ; }
-fail() { log "ERROR: $*" ; exit 1 ; }
-
-initialize()
-{
- if [[ $UID -eq 0 ]] ; then
- [[ -s /etc/conf.d/redis ]] && \
- source /etc/conf.d/redis
- else
- redis_user="$USER"
- fi
-
- true \
- ${redis_user:="redis"} \
- ${redis_port:="6379"} \
- ${redis_bin_path:="${packages_path}/active/bin"} \
- ${redis_server_binary:="${redis_bin_path}/redis-server"} \
- ${redis_pid_file:="/var/run/redis/redis.pid"} \
- ${redis_config_file:="/etc/redis/redis.conf"}
-
- if [[ -s "$redis_pid_file" ]] ; then
- pid=$(cat "$redis_pid_file")
- else
- rm -f "$redis_pid_file"
- fi
-
- return 0
-}
-
-redis_help()
-{
- printf "
-
-Usage:
-
- $0 <options> <action>
-
-Options:
-
- --conf - Path to redis.conf file
- --pid - Path to redis pid file
- --bin - Path to redis-server binary
- --user - Username to invoke redis as
- --trace - Use to debugging this control script
-
-Description:
-
- start - Start Redis
- stop - Stop Redis
- restart - Restart Redis
- info - Display Redis INFO output for the server
- status - Show if Redis is running and on what port if so.
- help - Display this usage information
-
-"
- return 0
-}
-
-redis_start()
-{
- [[ -s "$redis_pid_file" ]] &&
- fail "$redis_pid_file exists, redis-server is either already running or crashed.\n"
-
- log "#starting Redis as $redis_user using $redis_config_file..."
-
- if [[ "$redis_user" != "$USER" ]] ; then
- su "$redis_user" -c "\"$redis_server_binary\" \"$redis_config_file\""
- else
- "$redis_server_binary" "$redis_config_file"
- fi
-
- return $?
-}
-
-redis_stop()
-{
- [[ -s "$redis_pid_file" ]] || \
- fail "$redis_pid_file does not exist, Redis is not running"
-
- log "#stopping Redis as $redis_user using $redis_config_file..."
-
- "${redis_server_binary/%server/cli}" shutdown
-
- while [[ -x /proc/${pid} ]] ; do
- log "Waiting for the redis server to shutdown ..."
- sleep 1
- done
-
- rm -f $redis_pid_file
- log "redis server stopped."
-}
-
-redis_restart()
-{
- log "#restarting Redis server..."
- if [[ -s "$redis_pid_file" ]] ; then
- redis_stop
- else
- log "Redis is not running, proceeding."
- fi
- redis_start
-
- return $?
-}
-
-redis_info()
-{
- [[ -s "$redis_pid_file" ]] || \
- fail "$redis_pid_file does not exist, Redis is not running"
-
- "${redis_server_binary/%server/cli}" INFO
-
- return $?
-}
-
-initialize
-
-while [[ $# -gt 0 ]] ; do
- token="$1" ; shift
- case "$token" in
- --trace) set -o xtrace ;;
- --conf) redis_config_file="$1" ; shift ;;
- --pid) redis_pid_file="$1" ; shift ;;
- --bin) redis_bin_path="$1" ; shift ;;
- start) redis_start ;;
- stop) redis_stop ;;
- restart) redis_restart ;;
- info) redis_info ;;
- help) redis_help ;;
- *) redis_help ; exit 1 ;;
- esac
-done
-
-exit $?

0 comments on commit 184f92e

Please sign in to comment.