Commit 39d9a1b2 authored by Tim Smith's avatar Tim Smith
Browse files

Start managing the runit service correctly



I feel as if I'm missing something here. Why were we not doing this before. If this service isn't properly started at boot then runit just doesn't work. We need to make sure it's started and enabled.
Signed-off-by: Tim Smith's avatarTim Smith <tsmith@chef.io>
parent 061aaac5
......@@ -16,16 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
service 'runit' do
action :nothing
end
execute 'start-runsvdir' do # ~FC004
command '/etc/init.d/runit-start start'
action :nothing
end
case node['platform_family']
when 'rhel', 'amazon'
......@@ -41,12 +31,6 @@ when 'rhel', 'amazon'
end
package 'runit'
service 'runsvdir-start' do
action [:start, :enable]
only_if { node['platform_version'].to_i == 7 }
end
when 'debian'
# debian 9+ ship with runit-systemd which includes only what you need for process supervision and not
# what is necessary for running runit as pid 1, which we don't care about.
......@@ -59,4 +43,26 @@ when 'debian'
else
raise 'The cookbook only supports Debian/RHEL based Linux distributions. If you believe further platform support is possible pleae open a pull request.'
end
# we need to make sure we start the runit service so that runit services can be started up at boot
# or when they fail
service_name = case node['platform_family']
when 'debian'
if platform?('ubuntu') && node['platform_version'].to_f < 16.04
'runsvdir'
else
'runit'
end
when 'rhel'
if node['platform_version'].to_i >= 7
'runsvdir-start'
else
'runsvdir'
end
end
service service_name do
action [:start, :enable]
# this might seem crazy, but RHEL 6 is in fact Upstart and the runit service is upstart there
provider Chef::Provider::Service::Upstart if platform?('amazon') || platform_family?('rhel') && node['platform_version'].to_i == 6
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment