User3
User3

Reputation: 69

running a .sh from chef recipe

I am trying to run a .sh script from a recipe. It says Chef client completed. Running handlers complete. But the .sh script wasn't run. The recipe has the below. What is wrong?

execute "run script" do 
    command "sh /scratch/chef/installm.sh compact /scratch/chef" 
end

Upvotes: 0

Views: 1486

Answers (2)

Smita J
Smita J

Reputation: 1

Is the installm.sh script already there at client node where you are trying to run the cookbook? else try copying the script using source.

cookbook_file "/scratch/chef/installm.sh" do
  source "installm.sh"
  mode 0755
 end

keep install.sh in your cookbook path cookbook_name/files/default

Upvotes: 0

User3
User3

Reputation: 69

I was able to run with -l debug option. The .sh script was throwing an error saying JAVA_HOME wasn't set. Thanks.

Upvotes: 1

Related Questions