Sha256: 0d0f0aeead913b331305085b68021bb28c9b7ecca424e6d308f8bc9493161c89
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
namespace :rubber do namespace :nginx do rubber.allow_optional_tasks(self) # serial_task can only be called after roles defined - not normally a problem, but # rubber auto-roles don't get defined till after all tasks are defined on :load do rubber.serial_task self, :serial_restart, :roles => :nginx do sudo "/etc/init.d/nginx restart" end rubber.serial_task self, :serial_reload, :roles => :nginx do sudo "sh -c 'if ! ps ax | grep -v grep | grep -c nginx &> /dev/null; then /etc/init.d/nginx start; else /etc/init.d/nginx reload; fi'" end end before "deploy:stop", "rubber:nginx:stop" after "deploy:start", "rubber:nginx:start" after "deploy:restart", "rubber:nginx:reload" desc "Stops the nginx web server" task :stop, :roles => :nginx, :on_error => :continue do sudo "/etc/init.d/nginx stop" end desc "Starts the nginx web server" task :start, :roles => :nginx do sudo "/etc/init.d/nginx start" end desc "Restarts the nginx web server" task :restart, :roles => :nginx do serial_restart end desc "Reloads the nginx web server" task :reload, :roles => :nginx do serial_reload end end end
Version data entries
3 entries across 3 versions & 1 rubygems