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


Chronological Thread 
  • From: Vladimir Skubriev < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: How to check that service is stopped, and if not - stop it ?
  • Date: Wed, 16 Oct 2013 09:02:35 +0400

On 10/15/2013 06:42 PM, Seth Falcon wrote:

 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?

That's help of course.
I know how I can do check in bash. Purely theoretically I can use next condition

not_if { File.exist?(/run/apache2.pid) }

But I was hope that chef has a built-in syntax to check service status.

Because I don't want to waste a time to create and run script if script should not run.

Thank you for hint.

--
Best regards,

CVision Lab System Administrator
Vladmir Skubriev




Archive powered by MHonArc 2.6.16.

§