description "Zookeeper"

limit nofile 32768 32768

start on runlevel [2345]
stop on [!12345]

respawn
respawn limit 2 5

umask 007

kill timeout 300

setuid <%= node['zookeeper']['user'] %>
setgid <%= node['zookeeper']['group'] %>

exec <%= node['zookeeper']['install_dir'] %>/zookeeper-<%= node['zookeeper']['version'] %>/bin/zkServer.sh start-foreground

post-start script
  PID=`status zookeeper | egrep -oi '([0-9]+)$' | head -n1`
  echo $PID > /var/run/zk/zookeeper.pid
end script

post-stop script
  rm -f /var/run/zk/zookeeper.pid
end script

description "Zookeeper"

limit nofile 32768 32768

start on runlevel [2345]
stop on [!12345]

respawn
respawn limit 2 5

umask 007

kill timeout 300

setuid <%= node['zookeeper']['user'] %>
setgid <%= node['zookeeper']['group'] %>

exec <%= node['zookeeper']['install_dir'] %>/zookeeper-<%= node['zookeeper']['version'] %>/bin/zkServer.sh start-foreground

post-start script
  PID=`status zookeeper | egrep -oi '([0-9]+)$' | head -n1`
  echo $PID > /opt/zookeeper/zookeeper.pid
end script

post-stop script
  rm -f /opt/zookeeper/zookeeper.pid
end script

Write pid file to a directory that doesn't get deleted
Write pid file to a directory that doesn't get deleted
