Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ Require one of the above 'Environments Supported' in your `Capfile`:
require 'capistrano/apache/systemd'
```

`capistrano/apache` comes with 5 tasks:
`capistrano/apache` comes with 7 tasks:

* apache:reload
* apache:force_reload
* apache:restart
* apache:graceful
* apache:stop
* apache:graceful_stop

You can execute the task on command line:

Expand Down
14 changes: 14 additions & 0 deletions lib/capistrano/apache/tasks/systemd.rake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ namespace :apache do
end
end

desc 'Gracefuly stop apache (requires root access to apache stop)'
task :graceful_stop do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "graceful-stop #{fetch(:apache_service_name)}.service") : execute(fetch(:systemctl_location), "graceful-stop #{fetch(:apache_service_name)}.service")
end
end

desc 'Start apache (requires root access to apache start)'
task :start do
on release_roles(fetch(:apache_roles)) do
Expand All @@ -33,6 +40,13 @@ namespace :apache do
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "restart #{fetch(:apache_service_name)}.service") : execute(fetch(:systemctl_location), "restart #{fetch(:apache_service_name)}.service")
end
end

desc 'Gracefuly restart apache (requires root access to apache restart)'
task :graceful do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "graceful #{fetch(:apache_service_name)}.service") : execute(fetch(:systemctl_location), "graceful #{fetch(:apache_service_name)}.service")
end
end
end


14 changes: 14 additions & 0 deletions lib/capistrano/apache/tasks/sysv_upstart.rake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ namespace :apache do
end
end

desc 'Gracefuly stop apache'
task :graceful_stop do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, "/etc/init.d/#{fetch(:apache_service_name)}", 'graceful-stop') : execute("/etc/init.d/#{fetch(:apache_service_name)}", 'graceful-stop')
end
end

desc 'Start apache'
task :start do
on release_roles(fetch(:apache_roles)) do
Expand All @@ -33,4 +40,11 @@ namespace :apache do
fetch(:apache_with_sudo) ? execute(:sudo, "/etc/init.d/#{fetch(:apache_service_name)}", 'restart') : execute("/etc/init.d/#{fetch(:apache_service_name)}", 'restart')
end
end

desc 'Gracefuly restart apache'
task :graceful do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, "/etc/init.d/#{fetch(:apache_service_name)}", 'graceful') : execute("/etc/init.d/#{fetch(:apache_service_name)}", 'graceful')
end
end
end