Permalink
Browse files

add control_user parameter

  • Loading branch information...
1 parent 26f9c83 commit 6806a028dbd603adc2cf55c726dfd6e9c51826fa Marius Sturm committed with jtimberman Jul 11, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 definitions/runit_service.rb
@@ -17,7 +17,8 @@
# limitations under the License.
#
-define :runit_service, :directory => nil, :only_if => false, :finish_script => false, :control => [], :run_restart => true, :active_directory => nil, :owner => "root", :group => "root", :template_name => nil, :log_template_name => nil, :control_template_names => {}, :finish_script_template_name => nil, :start_command => "start", :stop_command => "stop", :restart_command => "restart", :status_command => "status", :options => Hash.new, :env => Hash.new, :default_logger => false, :nolog => false do
+ define :runit_service, :directory => nil, :only_if => false, :finish_script => false, :control => [], :run_restart => true, :active_directory => nil, :owner => "root", :group => "root", :control_user => nil, :template_name => nil, :log_template_name => nil, :control_template_names => {}, :finish_script_template_name => nil, :start_command => "start", :stop_command => "stop", :restart_command => "restart", :status_command => "status", :options => Hash.new, :env => Hash.new , :default_logger => false, :nolog => false do
+
include_recipe "runit"
params[:directory] ||= node[:runit][:sv_dir]
@@ -169,6 +170,23 @@
not_if { FileTest.pipe?("#{sv_dir_name}/supervise/ok") }
end
+ if params[:control_user]
+ directory "#{sv_dir_name}/supervise" do
+ owner params[:control_user]
+ group params[:group]
+ mode 0700
+ action :create
+ end
+
+ %w{ok control}.each do |control_file|
+ file "#{sv_dir_name}/supervise/#{control_file}" do
+ action :touch
+ owner params[:control_user]
+ only_if { File.exists? "#{sv_dir_name}/supervise/#{control_file}" }
+ end
+ end
+ end
+
service params[:name] do
control_cmd = node[:runit][:sv_bin]
if params[:owner]

0 comments on commit 6806a02

Please sign in to comment.