# File lib/chef/resource/service.rb, line 30 def initialize(name, run_context=nil) super @resource_name = :service @service_name = name @enabled = nil @running = nil @parameters = nil @pattern = service_name @start_command = nil @stop_command = nil @status_command = nil @restart_command = nil @reload_command = nil @init_command = nil @priority = nil @timeout = nil @action = "nothing" @supports = { :restart => false, :reload => false, :status => false } @allowed_actions.push(:enable, :disable, :start, :stop, :restart, :reload) if(run_context && run_context.node[:init_package] == "systemd") @provider = Chef::Provider::Service::Systemd end end
if the service is enabled or not
# File lib/chef/resource/service.rb, line 130 def enabled(arg=nil) set_or_return( :enabled, arg, :kind_of => [ TrueClass, FalseClass ] ) end
The path to the init script associated with the service. On many distributions this is ‘/etc/init.d/SERVICE_NAME’ by default. In non-standard configurations setting this value will save having to specify overrides for the start_command, stop_command and restart_command attributes.
# File lib/chef/resource/service.rb, line 121 def init_command(arg=nil) set_or_return( :init_command, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/service.rb, line 174 def parameters(arg=nil) set_or_return( :parameters, arg, :kind_of => [ Hash ] ) end
regex for match against ps -ef when !supports && status == nil
# File lib/chef/resource/service.rb, line 64 def pattern(arg=nil) set_or_return( :pattern, arg, :kind_of => [ String ] ) end
Priority arguments can have two forms:
a simple number, in which the default start runlevels get that as the start value and stop runlevels get 100 - value.
a hash like { 2 => [:start, 20], 3 => [:stop, 55] }, where the service will be marked as started with priority 20 in runlevel 2, stopped in 3 with priority 55 and no symlinks or similar for other runlevels
# File lib/chef/resource/service.rb, line 157 def priority(arg=nil) set_or_return( :priority, arg, :kind_of => [ Integer, String, Hash ] ) end
# File lib/chef/resource/service.rb, line 108 def reload_command(arg=nil) set_or_return( :reload_command, arg, :kind_of => [ String ] ) end
command to call to restart service
# File lib/chef/resource/service.rb, line 100 def restart_command(arg=nil) set_or_return( :restart_command, arg, :kind_of => [ String ] ) end
if the service is running or not
# File lib/chef/resource/service.rb, line 139 def running(arg=nil) set_or_return( :running, arg, :kind_of => [ TrueClass, FalseClass ] ) end
# File lib/chef/resource/service.rb, line 55 def service_name(arg=nil) set_or_return( :service_name, arg, :kind_of => [ String ] ) end
command to call to start service
# File lib/chef/resource/service.rb, line 73 def start_command(arg=nil) set_or_return( :start_command, arg, :kind_of => [ String ] ) end
command to call to get status of service
# File lib/chef/resource/service.rb, line 91 def status_command(arg=nil) set_or_return( :status_command, arg, :kind_of => [ String ] ) end
command to call to stop service
# File lib/chef/resource/service.rb, line 82 def stop_command(arg=nil) set_or_return( :stop_command, arg, :kind_of => [ String ] ) end
Generated with the Darkfish Rdoc Generator 2.