Skip to content

Instantly share code, notes, and snippets.

@pcreux
Created March 10, 2011 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcreux/864929 to your computer and use it in GitHub Desktop.
Save pcreux/864929 to your computer and use it in GitHub Desktop.
#...
monit_process "postfix" do
pid_file "/var/spool/postfix/pid/master.pid"
executable "/etc/init.d/postfix"
end
#...
# /etc/init.d/* scripts always have to be run as 'root'. These scripts take care of
# launching processes with the right user (www-data, aptproxy, nagios ...)
define :monit_process, :pid_file => nil, :executable => nil, :user => 'root', :group => nil do
execute "monit_reload" do
command "/usr/sbin/monit reload"
end
template "/etc/monit/conf.d/#{params[:name]}.monitrc" do
source "monit_process.monitrc.erb"
cookbook "monit"
variables(params)
notifies :run, resources(:execute => "monit_reload")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment