Permalink
Browse files

Allow the runit service start/stop/restart/status command to be custo…

…mised.
  • Loading branch information...
1 parent fa8524b commit bf61e22291de57aeb7e9cf21e8095e4ce674cb1f @craigw craigw committed with jtimberman Aug 5, 2010
Showing with 5 additions and 5 deletions.
  1. +5 −5 definitions/runit_service.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-define :runit_service, :directory => nil, :only_if => false, :finish_script => false, :control => [], :run_restart => true, :options => Hash.new do
+define :runit_service, :directory => nil, :only_if => false, :finish_script => false, :control => [], :run_restart => true, :start_command => "start", :stop_command => "stop", :restart_command => "restart", :status_command => "status", :options => Hash.new do
include_recipe "runit"
params[:directory] ||= node[:runit][:sv_dir]
@@ -106,10 +106,10 @@
service params[:name] do
provider Chef::Provider::Service::Init
supports :restart => true, :status => true
- start_command "#{node[:runit][:sv_bin]} start #{params[:name]}"
- stop_command "#{node[:runit][:sv_bin]} stop #{params[:name]}"
- restart_command "#{node[:runit][:sv_bin]} restart #{params[:name]}"
- status_command "#{node[:runit][:sv_bin]} status #{params[:name]}"
+ start_command "#{node[:runit][:sv_bin]} #{params[:start_command]} #{params[:name]}"
+ stop_command "#{node[:runit][:sv_bin]} #{params[:stop_command]} #{params[:name]}"
+ restart_command "#{node[:runit][:sv_bin]} #{params[:restart_command]} #{params[:name]}"
+ status_command "#{node[:runit][:sv_bin]} #{params[:status_command]} #{params[:name]}"
if params[:run_restart]
subscribes :restart, resources(:template => "#{sv_dir_name}/run"), :delayed
end

0 comments on commit bf61e22

Please sign in to comment.