Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Last active December 20, 2015 10:39
Show Gist options
  • Save jtimberman/6116757 to your computer and use it in GitHub Desktop.
Save jtimberman/6116757 to your computer and use it in GitHub Desktop.
Anatomy of a "plain defaults" runit_service resource, and its complimentary service resource (`:service_mirror`)
{
:name=>"plain-defaults",
# parameters specific to runit_service
:sv_bin => "/usr/bin/sv",
:sv_dir => "/etc/sv",
:service_dir => "/etc/service",
:lsb_init_dir => "/etc/init.d",
:control => [],
:options => {},
:env => {},
:log => true,
:cookbook => nil,
:finish => false,
:owner => nil,
:group => nil,
:default_logger => false,
:restart_on_update => true,
:run_template_name => "plain-defaults",
:log_template_name => "plain-defaults",
:finish_script_template_name => "plain-defaults",
:control_template_names => {},
:sv_templates => true,
:log_size => nil,
:log_num => nil,
:log_min => nil,
:log_timeout => nil,
:log_processor => nil,
:log_socket => nil,
:log_prefix => nil,
:log_config_append => nil,
# runit_service creates a "service" resource, for compatibility
:service_mirror =>
{
name: "plain-defaults",
supports: {:restart => true, :reload => true, :status => true},
provider: Chef::Provider::Service::Simple,
noop: nil, before: nil, params: {},
allowed_actions: [:nothing, :enable, :disable, :start, :stop, :restart, :reload],
action: [:nothing],
updated: false,
updated_by_last_action: false,
ignore_failure: false,
retries: 0,
retry_delay: 2,
source_line: nil,
elapsed_time: 0,
resource_name: :service,
service_name: "plain-defaults",
enabled: nil,
running: nil,
parameters: nil,
pattern: "plain-defaults",
start_command: "/usr/bin/sv start /etc/service/plain-defaults",
stop_command: "/usr/bin/sv stop /etc/service/plain-defaults",
status_command: "/usr/bin/sv status /etc/service/plain-defaults",
restart_command: "/usr/bin/sv restart /etc/service/plain-defaults",
reload_command: nil,
init_command: nil,
priority: nil,
startup_type: :automatic
},
# inherited parameters (from service), may be customized by runit_service
:provider => Chef::Provider::Service::Runit,
:allowed_actions => [:nothing, :start, :stop, :enable, :disable, :restart, :reload, :status, :once, :hup, :cont, :term, :kill, :up, :down, :usr1, :usr2],
:action => :enable,
:supports => {:restart => true, :reload => true, :status => true},
:enabled => false,
:running => false,
:pattern => "plain-defaults",
:start_command => nil,
:stop_command => nil,
:status_command => "/usr/bin/sv status /etc/service",
:restart_command => nil,
:reload_command => nil,
:init_command => nil,
:priority => nil,
:startup_type => :automatic,
# common parameters (for all resources)
:ignore_failure => false,
:retries => 0,
:retry_delay => 2,
:source_line => "(irb#1):5:in `irb_binding'",
:elapsed_time => 0,
:resource_name => :runit_service,
:service_name => "plain-defaults",
:noop => nil,
:before => nil,
:params => {},
:updated => false,
:updated_by_last_action => false,
:parameters => nil,
:cookbook_name => nil,
:recipe_name => nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment