From 0255400f731f8a4ce49e9745c7f2baa0bec208b6 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 8 Dec 2015 09:09:21 +0000 Subject: [PATCH] Run statistics and cleanup scripts with right ruby version --- cookbooks/web/recipes/cleanup.rb | 4 ++++ cookbooks/web/recipes/statistics.rb | 3 ++- cookbooks/web/templates/default/cleanup.cron.erb | 2 +- cookbooks/web/templates/default/statistics.erb | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cookbooks/web/recipes/cleanup.rb b/cookbooks/web/recipes/cleanup.rb index 8b8faca43..2b1039020 100644 --- a/cookbooks/web/recipes/cleanup.rb +++ b/cookbooks/web/recipes/cleanup.rb @@ -19,9 +19,13 @@ include_recipe "web::base" +ruby = "ruby#{node[:passenger][:ruby_version]}" +rails_directory = "#{node[:web][:base_directory]}/rails" + template "/etc/cron.daily/web-cleanup" do source "cleanup.cron.erb" owner "root" group "root" mode 0755 + variables :ruby => ruby, :directory => rails_directory end diff --git a/cookbooks/web/recipes/statistics.rb b/cookbooks/web/recipes/statistics.rb index c7bf9e81a..1be580c1e 100644 --- a/cookbooks/web/recipes/statistics.rb +++ b/cookbooks/web/recipes/statistics.rb @@ -19,6 +19,7 @@ include_recipe "web::base" +ruby = "ruby#{node[:passenger][:ruby_version]}" rails_directory = "#{node[:web][:base_directory]}/rails" template "/usr/local/bin/statistics" do @@ -26,7 +27,7 @@ template "/usr/local/bin/statistics" do owner "root" group "root" mode 0755 - variables :directory => rails_directory + variables :ruby => ruby, :directory => rails_directory end template "/etc/cron.d/statistics" do diff --git a/cookbooks/web/templates/default/cleanup.cron.erb b/cookbooks/web/templates/default/cleanup.cron.erb index 996aeec9a..390b5bcc4 100644 --- a/cookbooks/web/templates/default/cleanup.cron.erb +++ b/cookbooks/web/templates/default/cleanup.cron.erb @@ -1,3 +1,3 @@ #!/bin/sh -<%= node[:web][:base_directory] %>/rails/script/cleanup +<%= @ruby %> <%= @directory %>/script/cleanup diff --git a/cookbooks/web/templates/default/statistics.erb b/cookbooks/web/templates/default/statistics.erb index 87386a23d..ccfe956cc 100644 --- a/cookbooks/web/templates/default/statistics.erb +++ b/cookbooks/web/templates/default/statistics.erb @@ -4,7 +4,7 @@ export PATH=$PATH:/usr/local/bin # Generate new statistics -<%= @directory %>/script/statistics > <%= @directory %>/tmp/data_stats.html +<%= @ruby %> <%= @directory %>/script/statistics > <%= @directory %>/tmp/data_stats.html # Move new statistics into place mv -f <%= @directory %>/tmp/data_stats.html /store/rails/stats -- 2.43.2