How to check if a service is running in chef?

chef-infra, chef-recipe, ruby

Solution

Chef is declarative. So the code you've written does exactly what you've described.

Problem

In a recipe file, i need to check if a service is already running. If it is, I need to stop it. I have ``` service "apache" do supports :status => true action :stop end ``` Any help will be appreciated.

Original source