Last active
April 5, 2016 09:57
-
-
Save fguillen/6333789 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
SERVICES = [ | |
{ | |
:domain => "abandonbikes.fernandoguillen.info", | |
:port => "3020", | |
:gemset => "1.9.2-p290@abandon_bikes" | |
}, | |
{ | |
:domain => "bookysitter.com", | |
:port => "3050", | |
:gemset => "1.9.2-p290@booky_sitter" | |
}, | |
{ | |
:domain => "holaporque.com", | |
:port => "3060", | |
:gemset => "1.9.3-p484@holaporque" | |
}, | |
{ | |
:domain => "linoescalera.com", | |
:port => "3140", | |
:gemset => "1.9.3-p286@lino_escalera" | |
}, | |
{ | |
:domain => "memmermolano.com", | |
:port => "3110", | |
:gemset => "1.9.3-p286@memmermolano" | |
}, | |
{ | |
:domain => "rubiodemarzo.fernandoguillen.info", | |
:port => "3150", | |
:gemset => "1.9.3-p286@rubio_de_marzo" | |
}, | |
{ | |
:domain => "socis.cineciutat.org", | |
:port => "3040", | |
:gemset => "1.9.2-p290@cineciutat_socis" | |
}, | |
{ | |
:domain => "staging_socis.fernandoguillen.info", | |
:port => "3070", | |
:gemset => "1.9.2-p290@staging_cineciutat_socis", | |
:environment => "staging" | |
}, | |
# { | |
# :domain => "yotengouncine.org", | |
# :port => "3160", | |
# :gemset => "1.9.3-p286@yo_tengo_un_cine", | |
# }, | |
# { | |
# :domain => "daliapublishermpanl.fernandoguillen.info", | |
# :port => "3170", | |
# :gemset => "1.9.3-p286@dalia_publisher_mpanl" | |
# }, | |
# { | |
# :domain => "daliaexchangeplatform.fernandoguillen.info", | |
# :port => "3180", | |
# :gemset => "1.9.3-p286@dalia_exchange_platform" | |
# }, | |
# { | |
# :domain => "daliaresearchercontrolpanel.fernandoguillen.info", | |
# :port => "3190", | |
# :gemset => "1.9.3-p286@dalia_researcher_control_panel" | |
# }, | |
{ | |
:domain => "mintegimoves.com", | |
:port => "3200", | |
:gemset => "1.9.3-p286@mintegi_moves" | |
}, | |
{ | |
:domain => "elpresenteperfecto.com", | |
:port => "3210", | |
:gemset => "1.9.3-p286@el_presente_perfecto" | |
}, | |
{ | |
:domain => "kontrabandofilmfestival.org", | |
:port => "3240", | |
:gemset => "1.9.3-p286@kbff" | |
} | |
] | |
def execute(command, service) | |
command_result = [] | |
command_result << "source /home/fguillen/.rvm/environments/ruby-#{service[:gemset]}" if service[:gemset] | |
command_result << "cd /home/www/#{service[:domain]}" | |
command_result << command | |
command_result = command_result.join(" && ") | |
puts ">> #{command_result}" | |
result = `#{command_result}` | |
puts ">>>: exitstatus: #{$?.exitstatus}" | |
end | |
puts "Authomatic starts" | |
puts "---" | |
SERVICES.each do |service| | |
puts service[:domain] | |
execute "passenger stop -p #{service[:port]}", service | |
execute "passenger start -p #{service[:port]} -e #{service[:environment] || "production"} -d", service | |
puts "--" | |
end | |
puts | |
puts "Manual starts" | |
puts "---" | |
# puts "adialoffice.adialhigiene.com delayed job!" | |
# execute("RAILS_ENV=production script/delayed_job start", {:gemset => "1.8.7-p352@adialoffice", :domain => "adialoffice.adialhigiene.com"}) | |
puts "taximallorcaairport.com delayed job!" | |
execute("sudo RAILS_ENV=production script/delayed_job start", {:domain => "taximallorcaairport.com"}) | |
puts "Date Synch" | |
puts `sudo ntpdate ntp.ubuntu.com` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment