#!/bin/bash
# Stop redis

# TODO: this script assumes that the redis-server will reside on the same
#       host as the web-server.  Not true in the production environment.
#       Redis is going to be managed as an external service just like the
#       PostgreSQL database server.


my_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $my_dir/check_app_root

pidfile=$APP_ROOT/tmp/pids/redis.pid

echo -n "Killing redis ... "

if [ -e "$pidfile" ] ; then
  kill -TERM `cat $pidfile`
  sleep 1
  rm -f $pidfile
  echo "done."
else
  echo "was not running."
fi
