# class Chef::Provider::Service::Solaris

### Attributes

maintenance[R]

### Public Class Methods

new(new_resource, run_context=nil) click to toggle source
Calls superclass method Chef::Provider::Service.new

    # File lib/chef/provider/service/solaris.rb, line 30
    def initialize(new_resource, run_context=nil)
      super
      @init_command = "/usr/sbin/svcadm"
      @status_command = "/bin/svcs -l"
      @maintenace     = false
    end

### Public Instance Methods

disable_service() click to toggle source

    # File lib/chef/provider/service/solaris.rb, line 53
    def disable_service
      shell_out!("#{default_init_command} disable -s #{@new_resource.service_name}")
    end

Also aliased as: stop_service
enable_service() click to toggle source

    # File lib/chef/provider/service/solaris.rb, line 48
    def enable_service
      shell_out!("#{default_init_command} clear #{@new_resource.service_name}") if @maintenance
      shell_out!("#{default_init_command} enable -s #{@new_resource.service_name}")
    end

Also aliased as: start_service
load_current_resource() click to toggle source

    # File lib/chef/provider/service/solaris.rb, line 38
    def load_current_resource
      @current_resource = Chef::Resource::Service.new(@new_resource.name)
      @current_resource.service_name(@new_resource.service_name)
      unless ::File.exists? "/bin/svcs"
        raise Chef::Exceptions::Service, "/bin/svcs does not exist!"
      end
      @status = service_status.enabled
      @current_resource
    end

reload_service() click to toggle source

    # File lib/chef/provider/service/solaris.rb, line 60
    def reload_service
      shell_out!("#{default_init_command} refresh #{@new_resource.service_name}")
    end

restart_service() click to toggle source

    # File lib/chef/provider/service/solaris.rb, line 64
    def restart_service
      ## svcadm restart doesn't supports sync(-s) option
      disable_service
      return enable_service
    end

service_status() click to toggle source

    # File lib/chef/provider/service/solaris.rb, line 70
    def service_status
      status = shell_out!("#{@status_command} #{@current_resource.service_name}")
      status.stdout.each_line do |line|
        case line
        when /state\s+online/
          @current_resource.enabled(true)
          @current_resource.running(true)
        when /state\s+maintenance/
          @maintenance = true
        end
      end
      unless @current_resource.enabled
        @current_resource.enabled(false)
        @current_resource.running(false)
      end
      @current_resource
    end

start_service()
Alias for: enable_service
stop_service()
Alias for: disable_service