<% if_p("rabbitmq-server.restart_statsdb_cron_schedule") do |schedule| %>
tmpfile=$(mktemp)
echo 'PATH=/usr/bin:/bin:/var/vcap/packages/erlang/bin:/var/vcap/packages/rabbitmq-server/bin' > "${tmpfile}"
echo '<%= schedule %> vcap /var/vcap/packages/rabbitmq-server/bin/rabbitmqctl eval "supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup),rabbit_mgmt_sup_sup:start_child()."' >> "${tmpfile}"
cp "${tmpfile}" "/etc/cron.d/rabbitmq-statsdb-reset"
<% end %>

<% if_p("rabbitmq-server.restart_statsdb_cron_schedule") do |schedule| %>
cat << EOF > "/etc/cron.d/rabbitmq-statsdb-reset"

PATH=/usr/bin:/bin:/var/vcap/packages/erlang/bin:/var/vcap/packages/rabbitmq-server/bin
<%= schedule %> vcap rabbitmqctl eval "supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup),rabbit_mgmt_sup_sup:start_child()."

EOF
<% end %>

Refactor of generation of cronfile
Refactor of generation of cronfile

Use cat << EOF pattern instead of long echo

[#136577519]

Signed-off-by: Gareth Smith <97ec7f0e37ed298c6c7d61e7dba0820f215e55e4@pivotal.io>
