Sha256: a0e750c59686764e4c3b0f8557aa8cd8152313ff8c7d4a865f779ecf0c5c41fc

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

namespace :nginx do
  %w(start stop restart reload).each do |task_name|
    desc "#{task } Nginx"
    task task_name do
      on roles(:app), in: :sequence, wait: 5 do
        sudo "/etc/init.d/nginx #{task_name}"
      end
    end
  end

  desc "Remove default Nginx Virtual Host"
  task "remove_default_vhost" do 
    on roles(:app) do
      %w(/etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/000-default).each do |default_filename|
        if test("[ -f #{default_filename} ]")
          sudo "rm #{default_filename}"
          puts "Removed default Nginx Virtualhost: #{default_filename}"
        else
          puts "Default: #{default_filename} not found, not removed"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-cookbook-5.0.0 lib/capistrano/cookbook/tasks/nginx.cap