Skip to content

Instantly share code, notes, and snippets.

@jerome
Forked from nicolasblanco/gist:112281
Created May 16, 2009 14:42
Show Gist options
  • Select an option

  • Save jerome/112698 to your computer and use it in GitHub Desktop.

Select an option

Save jerome/112698 to your computer and use it in GitHub Desktop.
namespace :workling do
namespace :client do
desc "Starts workling client"
task :start, :roles => :app, :only => { :primary => true } do
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client stop'"
run "sudo -u #{app_user} bash -c 'cd #{current_path} && rm -f log/workling.output'"
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client start'"
end
desc "Stops workling client"
task :stop, :roles => :app, :only => { :primary => true } do
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client stop'"
end
end
namespace :starling do
task :setup, :roles => :app, :only => { :primary => true } do
# Create pool directory for Starling
run "#{sudo} mkdir -p /var/spool/starling"
end
desc "Starts Starling server"
task :start, :roles => :app, :only => { :primary => true } do
run "#{sudo} starling -d -h 0.0.0.0 -p 15151"
end
desc "Stops Starling server"
task :stop, :roles => :app, :only => { :primary => true } do
starling = capture "starling_top -p 15151"
starling_pid = YAML.load(starling)["pid"]
puts "Killing Starling, pid : #{starling_pid}"
run "#{sudo} kill #{starling_pid}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment