[chef] Re: Re: How to check that service is stopped, and if not - stop it ?


Chronological Thread 
  • From: Vladimir Skubriev < >
  • To:
  • Subject: [chef] Re: Re: How to check that service is stopped, and if not - stop it ?
  • Date: Tue, 15 Oct 2013 10:54:03 +0400

On 10/15/2013 10:25 AM, Christopher Armstrong wrote:
" type="cite">
I'm not sure where in your code sample you are trying to stop a service, but you can easily do this with the service resource: http://docs.opscode.com/resource_service.html

Example:
service "nginx" do
  action :stop
end



On Mon, Oct 14, 2013 at 11:22 PM, Vladimir Skubriev < " target="_blank"> > wrote:
How to check that service is stopped, and if not - stop it ?

For example in this code block:


# See if needed http://stackoverflow.com/questions/14809840/installation-of-redmine-with-bundler-requires-root-password
bash "bundle_redmine_mylyn" do
  cwd "#{node['redmine']['datafs']}/redmine/plugins/redmine_mylyn_connector"
  user node['apache']['user']
  code <<-EOH
              # We doing source because of interactive shell don't read our .profile
              source #{node['redmine']['home']}/.rvm/scripts/rvm
              bundle install
  EOH
end


And Can write some not_if's only_if's for example

do
    not_if
    not_if
    only_if
    only_if
end

?

--
Best regards,

CVision Lab System Administrator
Vladmir Skubriev


Okey.

May be i ask answer some incorrectly
I need a check if a service stopped
Before migration of db in this code block

bash "bundle_redmine_mylyn" do
  cwd "#{node['redmine']['datafs']}/redmine/plugins/redmine_mylyn_connector"
  user node['apache']['user']
  code <<-EOH
              # We doing source because of interactive shell don't read our .profile
              source #{node['redmine']['home']}/.rvm/scripts/rvm
              bundle install
  EOH
not_if SERVICE_IS_STARTED
end

i.e. SERVICE_IS_STARTED in ruby ?

-- 
Best regards,

CVision Lab System Administrator
Vladmir Skubriev



Archive powered by MHonArc 2.6.16.

§