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


Chronological Thread 
  • From: Seth Falcon < >
  • To:
  • Subject: [chef] Re: Re: Re: How to check that service is stopped, and if not - stop it ?
  • Date: Tue, 15 Oct 2013 07:42:05 -0700



 writes:
> 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

You can guard your bash resource with either a string which will be
executed as a shell command or a block of Ruby code. So:

    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 { File.exist?(some_file) }
    end

Does that help?

-- 
Seth Falcon | Development Lead | Opscode | @sfalcon




Archive powered by MHonArc 2.6.16.

§