Skip to content

Instantly share code, notes, and snippets.

@thbar
Created February 6, 2011 22:14
Show Gist options
  • Save thbar/813770 to your computer and use it in GitHub Desktop.
Save thbar/813770 to your computer and use it in GitHub Desktop.
ruby_block "Verify running processed" do
block do
missing_processes = []
[
"jetty",
"nginx",
"mongodb-#{node[:mongodb][:version]}",
"redis-#{node[:redis][:version]}"
].each do |process|
Chef::Log.debug("Checking process #{process}")
grep_name = process.gsub(/(.)(.*)/,"[\\1]\\2")
if `ps -A -o command | grep "#{grep_name}"`.empty?
Chef::Log.error("Missing process #{process}!!!")
missing_processes << process
end
end
raise "Missing processed - #{missing_processes.inspect}" unless missing_processes.empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment