2 changed files with 14 additions and 2 deletions
@ -0,0 +1,12 @@ |
|||||||
|
namespace :cf do |
||||||
|
desc "Only run on the first application instance" |
||||||
|
task on_first_instance: :environment do |
||||||
|
instance_index = -1 |
||||||
|
begin |
||||||
|
instance_index = JSON.parse(ENV["VCAP_APPLICATION"])["instance_index"] |
||||||
|
rescue StandardError |
||||||
|
nil |
||||||
|
end |
||||||
|
exit(0) unless instance_index.zero? |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue