# <%= @mysql_name %> Service

description     "MySQL service <%= @mysql_name %>"
author          "chef-client"

start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]

respawn
respawn limit 2 5

env HOME=/etc/<%= @mysql_name %>
umask 007

kill timeout 300

pre-start script
[ -d /run/<%= @mysql_name %> ] || install -m 755 -o <%= @run_user %> -g <%= @run_group %> -d /run/<%= @mysql_name %>
[ -d <%= @socket_dir %> ] || install -m 755 -o <%= @run_user %> -g <%= @run_group %> -d <%= @socket_dir %>
end script

exec /usr/sbin/mysqld --defaults-file=<%= @defaults_file %>

post-start script
/usr/sbin/<%= @mysql_name %>-wait-ready
end script
