Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ def delete_extra_env_files
def wait_for_service
raise 'Runit does not appear to be installed. Include runit::default before using the resource!' unless binary_exists?

sleep 1 until ::FileTest.pipe?(::File.join(service_dir_name, 'supervise', 'ok'))
wait_for_pipe(::File.join(service_dir_name, 'supervise', 'ok'))

if new_resource.log
sleep 1 until ::FileTest.pipe?(::File.join(service_dir_name, 'log', 'supervise', 'ok'))
wait_for_pipe(::File.join(service_dir_name, 'log', 'supervise', 'ok'))
end
end

def wait_for_pipe(path)
sleep 1 until ::FileTest.pipe?(path)

# Opening the pipe for writing should block until the supervisor
# has opened it for reading.
::File.open(path, 'w').close()
end

def runit_send_signal(signal, friendly_name = nil)
friendly_name ||= signal
converge_by("send #{friendly_name} to #{new_resource}") do
Expand Down
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

package pkg_name do # ~FC009
action :install
response_file 'runit.seed'
response_file 'runit.seed'
end
else
raise 'The cookbook only supports Debian/RHEL based Linux distributions. If you believe further platform support is possible please open a pull request.'
Expand Down