<commit_before>#
# Cookbook Name:: monit
# Recipe:: default
#

package "monit"

# configuration file
template node["monit"]["main_config_path"] do
  owner  "root"
  group  "root"
  mode   "0600"
  source "monitrc.erb"
  notifies :reload, "service[monit]" if node["monit"]["reload_on_change"]
end

directory "/var/monit" do
  owner "root"
  group "root"
  mode  "0700"
end

# enable service startup
execute "enable-monit-startup" do
  command "/bin/sed s/START=no/START=yes/ -i /etc/default/monit"
  not_if "grep 'START=yes' /etc/default/monit"
  only_if { platform_family?("debian") }
end

# system service
service "monit" do
  supports restart: true, start: true, reload: true
  action :enable

  case node["platform_family"]
  when "rhel", "fedora", "suse"
    start_command   "/sbin/service monit start"
    restart_command "/sbin/service monit restart"
    reload_command  "monit reload"
  when "debian"
    start_command   "/usr/sbin/invoke-rc.d monit start"
    restart_command "/usr/sbin/invoke-rc.d monit restart"
    reload_command  "monit reload"
  end
end

# build default monitrc files
node["monit"]["default_monitrc_configs"].each do |conf|
  monit_monitrc conf do
    variables(category: "system")
    notifies :reload, "service[monit]", :delayed
  end
end
<commit_msg>Allow either style of monit startup flag to work<commit_after>#
# Cookbook Name:: monit
# Recipe:: default
#

package "monit"

# configuration file
template node["monit"]["main_config_path"] do
  owner  "root"
  group  "root"
  mode   "0600"
  source "monitrc.erb"
  notifies :reload, "service[monit]" if node["monit"]["reload_on_change"]
end

directory "/var/monit" do
  owner "root"
  group "root"
  mode  "0700"
end

# enable service startup
execute "enable-monit-startup" do
  command "/bin/sed -e s/startup=0/startup=1/ -e s/START=no/START=yes/ \
          -i /etc/default/monit"
  not_if "grep -e 'startup=1' -e 'START=yes' /etc/default/monit"
  only_if { platform_family?("debian") }
end

# system service
service "monit" do
  supports restart: true, start: true, reload: true
  action :enable

  case node["platform_family"]
  when "rhel", "fedora", "suse"
    start_command   "/sbin/service monit start"
    restart_command "/sbin/service monit restart"
    reload_command  "monit reload"
  when "debian"
    start_command   "/usr/sbin/invoke-rc.d monit start"
    restart_command "/usr/sbin/invoke-rc.d monit restart"
    reload_command  "monit reload"
  end
end

# build default monitrc files
node["monit"]["default_monitrc_configs"].each do |conf|
  monit_monitrc conf do
    variables(category: "system")
    notifies :reload, "service[monit]", :delayed
  end
end

{'fraction_non_alphanumeric': 0.12669172932330827, 'fraction_numerical': 0.007142857142857143, 'mean_word_length': 4.020754716981132, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4366404', 'n_tokens_mistral': 971, 'n_tokens_neox': 962, 'n_words': 252}