[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: Fri, 18 Oct 2013 11:51:49 +0400

On 10/16/2013 04:25 PM, Tensibai wrote:
" type="cite">

Bis from mail client bug ...

no problem )
" type="cite">

I would use notifications for this use case, something like:

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
   action :nothing
   notifies :start, "service[apache2]
end

 

service "apache2" do

 action :stop

 notifies :run, "bash[bundle_redmine_mylyn]"

end

 

I has many bundle and rake block in a whole cookbook, which is setting up  redmine entirely

I need a check for security of production server data in during operation.

Because application server runned by apache should be stopeed. Bundle is not a clear example.

Must clear is rake db:migrate, for example.

Of course now i use in the home of all recipes

service "apache2" do

 action :stop

end


And at the end of all code


service "apache2" do

 action :start

end


But I think this is not good idea.


" type="cite">

More or less from memory so there may be syntax mistakes with notifications but the idea is there, if action :stop is too much it may be trigerred by another ressource (a dummy ruby_block just notyfing or anything else)

The major drawback I see from this way is that it is NOT idempotent and will do the same again and again at each chef-run if there's not way to test the install has to be done or not.

Regards,

Tensibai




 

 


-- 
Best regards,

CVision Lab System Administrator
Vladmir Skubriev



Archive powered by MHonArc 2.6.16.

§