Skip to content

Instantly share code, notes, and snippets.

@antonioalegria
Created November 27, 2009 19:44
Show Gist options
  • Save antonioalegria/244197 to your computer and use it in GitHub Desktop.
Save antonioalegria/244197 to your computer and use it in GitHub Desktop.
require 'yaml'
bluepill_config_yaml = %q{ ---
:app_name: esper-shiro
:working_dir: /Users/tonio/workspace/esper/
:log_file: /Users/tonio/workspace/esper/bluepill.log
:processes:
:Process2:
:pid_file: /var/bluepill/pids/esper-shiro-Process2.pid
:group: :shiro
:log_file: /Users/tonio/workspace/esper/esper-shiro-Process2.log.txt
:drb_port: 53842
:start_command: cd /Users/tonio/workspace/esper/ && jruby --client -e "require 'lib/runner'; process = Pulso::Esper::ProcessRunner.new(:Process2, 'druby://127.0.0.1:53842', :shiro, 'conf/config.yml'); process.run; process.listen"
:Process1:
:pid_file: /var/bluepill/pids/esper-shiro-Process1.pid
:group: :shiro
:log_file: /Users/tonio/workspace/esper/esper-shiro-Process1.log.txt
:drb_port: 53841
:start_command: cd /Users/tonio/workspace/esper/ && jruby --client -e "require 'lib/runner'; process = Pulso::Esper::ProcessRunner.new(:Process1, 'druby://127.0.0.1:53841', :shiro, 'conf/config.yml'); process.run; process.listen"
}
bluepill_config = YAML.load(bluepill_config_yaml)
Bluepill.application(bluepill_config[:app_name], :log_file => bluepill_config[:log_file]) do |app|
app.working_dir = bluepill_config[:working_dir]
bluepill_config[:processes].each do |proc_name, proc_details|
app.process(proc_name) do |process|
process.group = proc_details[:group]
process.start_command = proc_details[:start_command]
process.stop_command = "kill -9 {{PID}}"
process.pid_file = proc_details[:pid_file]
process.daemonize = true
process.stdout = proc_details[:log_file]
process.stderr = proc_details[:log_file]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment