-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsystemd.rake
More file actions
52 lines (44 loc) · 2.5 KB
/
systemd.rake
File metadata and controls
52 lines (44 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace :apache do
desc 'Reload apache (requires root access to apache reload)'
task :reload do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "reload #{fetch(:apache_service_name)}.service"): execute(fetch(:systemctl_location), "reload #{fetch(:apache_service_name)}.service")
end
end
desc 'Force reload apache (requires root access to apache reload)'
task :force_reload do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "force-reload #{fetch(:apache_service_name)}.service") : execute(fetch(:systemctl_location), "force-reload #{fetch(:apache_service_name)}.service")
end
end
desc 'Stop apache (requires root access to apache stop)'
task :stop do
on release_roles(fetch(:apache_roles)) do
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "stop #{fetch(:apache_service_name)}.service") : execute(fetch(:systemctl_location), "stop #{fetch(:apache_service_name)}.service")
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
fetch(:apache_with_sudo) ? execute(:sudo, fetch(:systemctl_location), "start #{fetch(:apache_service_name)}.service") : execute(fetch(:systemctl_location), "start #{fetch(:apache_service_name)}.service")
end
end
desc 'Restart apache (requires root access to apache restart)'
task :restart do
on release_roles(fetch(:apache_roles)) 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