Class: PoiseService::ServiceProviders::Upstart
- Includes:
- Chef::Mixin::ShellOut
- Defined in:
- lib/poise_service/service_providers/upstart.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
-
#action_reload ⇒ Object
Shim out reload if we have a version that predates reload support.
-
#action_restart ⇒ Object
True restart in Upstart preserves the original config data, we want the more obvious behavior like everything else in the world that restart would re-read the updated config file.
- #pid ⇒ Object
Class Method Details
.provides_auto?(node, resource) ⇒ Boolean
32 33 34 |
# File 'lib/poise_service/service_providers/upstart.rb', line 32 def self.provides_auto?(node, resource) service_resource_hints.include?(:upstart) end |
Instance Method Details
#action_reload ⇒ Object
Shim out reload if we have a version that predates reload support.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/poise_service/service_providers/upstart.rb', line 57 def action_reload return if ['never_reload'] if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP' if [:reload_shim] Process.kill(new_resource.reload_signal, pid) else check_reload_signal! end else super end end |
#action_restart ⇒ Object
True restart in Upstart preserves the original config data, we want the more obvious behavior like everything else in the world that restart would re-read the updated config file. Use stop+start to get this behavior. http://manpages.ubuntu.com/manpages/raring/man8/initctl.8.html
48 49 50 51 52 53 54 |
# File 'lib/poise_service/service_providers/upstart.rb', line 48 def action_restart return if ['never_restart'] action_stop # Give things a moment to stop before we try starting again. sleep(['restart_delay']) action_start end |
#pid ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/poise_service/service_providers/upstart.rb', line 70 def pid cmd = shell_out(%w{initctl status} + [new_resource.service_name]) if !cmd.error? && md = cmd.stdout.match(/process (\d+)/) md[1].to_i else nil end end |