Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Add support for RHEL #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
17 changes: 16 additions & 1 deletion lib/capistrano/tasks/unicorn.rake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ namespace :unicorn do
template "unicorn_init.erb", "/tmp/unicorn_init"
execute :chmod, "+x", "/tmp/unicorn_init"
sudo :mv, "/tmp/unicorn_init /etc/init.d/#{fetch(:unicorn_service_name)}"
sudo "update-rc.d -f #{fetch(:unicorn_service_name)} defaults"
if which('update-rc.d').nil?
sudo "chkconfig #{fetch(:unicorn_service_name)} on"
else
sudo "update-rc.d -f #{fetch(:unicorn_service_name)} defaults"
end
end
end

Expand All @@ -31,6 +35,17 @@ namespace :unicorn do
end
end
end

def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
exts.each { |ext|
exe = File.join(path, "#{cmd}#{ext}")
return exe if File.executable? exe
}
end
return nil
end
end

namespace :deploy do
Expand Down