Skip to content

Commit 355105b

Browse files
committed
Make runit service's control commands configurable
Signed-off-by: Balasankar "Balu" C <[email protected]>
1 parent 8128462 commit 355105b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

libraries/resource_runit_service.rb

+7-4
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ class RunitService < Chef::Resource::Service
5858
property :finish_script_template_name, String, default: lazy { service_name }
5959
property :control_template_names, Hash, default: lazy { set_control_template_names }
6060
property :status_command, String, default: lazy { "#{sv_bin} status #{service_name}" }
61+
property :start_command, String, default: 'start'
62+
property :stop_command, String, default: 'stop'
63+
property :restart_command, String, default: 'restart'
6164
property :sv_templates, [true, false], default: true
6265
property :sv_timeout, Integer
63-
property :sv_verbose, [true, false], default: false
66+
property :sv_verbose, [TrueClass, FalseClass], default: false
6467
property :log_dir, String, default: lazy { ::File.join('/var/log/', service_name) }
6568
property :log_flags, String, default: '-tt'
6669
property :log_size, Integer
@@ -100,10 +103,10 @@ def after_created
100103
find_resource(:service, new_resource.name) do # creates if it does not exist
101104
provider Chef::Provider::Service::Simple
102105
supports new_resource.supports
103-
start_command "#{new_resource.sv_bin} start #{service_dir_name}"
104-
stop_command "#{new_resource.sv_bin} stop #{service_dir_name}"
105-
restart_command "#{new_resource.sv_bin} restart #{service_dir_name}"
106106
status_command new_resource.status_command
107+
start_command "#{new_resource.sv_bin} #{new_resource.start_command} #{service_dir_name}"
108+
stop_command "#{new_resource.sv_bin} #{new_resource.stop_command} #{service_dir_name}"
109+
restart_command "#{new_resource.sv_bin} #{new_resource.restart_command} #{service_dir_name}"
107110
action :nothing
108111
end
109112
end

0 commit comments

Comments
 (0)