description "Start the redis-sentinel instance on port <%= @port %>"
author "Installed by chef redisio cookbook"

#start on runlevel [2345]
stop on runlevel [06]

script
  if [ ! -d <%= @piddir %> ]; then
    mkdir -p <%= @piddir %>
    chown <%= @user %>:<%= @group %>  <%= @piddir %>
  fi
end script

# If the job exits, restart it. Give up with more than 10 restarts in 30 seconds.
respawn
respawn limit 10 30

exec su -s /bin/sh -c 'exec "$0" "$@"' -- <%= @user %> <%= File.join(@bin_path, 'redis-server') %> <%= @configdir %>/<%= @name %>.conf --sentinel

