Blob of waves/events/lib/tasks/cluster.rb (raw blob data)

1 namespace :cluster do
2
3 desc 'Start a cluster of waves applications.'
4 task :start do |task|
5 ( Waves::Console.config.ports || [ Waves::Console.config.port ] ).each do |port|
6 cmd = "waves-server -p #{port} -c #{ENV['mode']||'development'} -d"
7 puts cmd ; `#{cmd}`
8 end
9 end
10
11 desc 'Stop a cluster of waves applications.'
12 task :stop do |task|
13 Dir[ :log / '*.pid' ].each do |path|
14 pid = File.basename(path,'.pid').to_i
15 puts "Stopping process #{pid} ..."
16 Process.kill( 'INT', pid ) rescue nil
17 end
18 end
19
20 desc 'Restart a cluster of waves applications.'
21 task :restart => [ :stop, :start ] do |task|
22 end
23
24 end