Last active
March 9, 2018 00:25
-
-
Save sveinn/d7e268ec1b68514902fcdabc5f7e4e0b 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 | |
ref_of_previous_head = ARGV[0] | |
ref_of_new_head = ARGV[1] | |
checkout_type = ARGV[2] | |
FILE_CHECKOUT = '0' | |
BRANCH_CHANGE = '1' | |
RESTART_PASSENGER_CMD = 'bundle exec passenger stop --port 3000; bundle exec passenger start --port 3000 --max-pool-size 2' | |
PROPERTY_DIR = File.expand_path('../../apps/property') | |
def restart_passenger(cmd, dir) | |
pid = spawn cmd, chdir: dir, [:out,:err] => '/dev/null' | |
Process.detach pid | |
end | |
if (checkout_type == BRANCH_CHANGE) | |
puts "#{__FILE__}: restarting passenger server" | |
restart_passenger(RESTART_PASSENGER_CMD,PROPERTY_DIR) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment