Permalink
Browse files

Restart nginx after configuration updates.

  • Loading branch information...
1 parent 7669506 commit 503629e2b263caf685e0a5b4967db58774f50f2c Michael van Rooijen committed Jul 3, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/ruby_vps/cli/nginx.rb
@@ -32,7 +32,8 @@ def self.source_root
def generate_config
co = load_connection_options!
- nginx_conf = Tempfile.new('nginx.conf')
+ nginx_conf = Tempfile.new("nginx.conf")
+ FileUtils.rm(nginx_conf.path)
template("main.conf", nginx_conf.path)
Net::SFTP.start(co[:ip], 'deployer', :password => co[:password], :port => co[:port]) do |sftp|
@@ -45,6 +46,8 @@ def generate_config
Net::SSH.start(co[:ip], 'deployer', :password => co[:password], :port => co[:port]) do |ssh|
ssh.exec! "sudo mv ~/tmp/nginx.conf #{options[:out]}/nginx.conf"
end
+
+ execute_remotely!("sudo start nginx || sudo restart nginx", "Restarting NGINX..")
end
# general
@@ -69,7 +72,8 @@ def generate_config
def generate_app_config
co = load_connection_options!
- app_conf = Tempfile.new('app.conf')
+ app_conf = Tempfile.new("nginx.conf")
+ FileUtils.rm(app_conf.path)
template("app.conf", app_conf.path)
Net::SFTP.start(co[:ip], 'deployer', :password => co[:password], :port => co[:port]) do |sftp|
@@ -97,6 +101,8 @@ def generate_app_config
end
end
end
+
+ execute_remotely!("sudo start nginx || sudo restart nginx", "Restarting NGINX..")
end
method_option :version, :type => :string, :aliases => "-v", :default => "1.0.4"

0 comments on commit 503629e

Please sign in to comment.