Chef - execute vs bash resource

Viewed 13643

I used both the execute resource or the bash resource.

Both achieve the same result:

bash 'Execute my script' do 
  user 'root'
  cwd  '/mydir'
  code <<-EOH
    ./myscript.sh
  EOH
end

execute 'Execute my script' do 
  user    'root'
  cwd     '/mydir'
  command './myscript.sh'
end

The only difference I see is that bash actually creates a shell script (named /tmp/chef-script#{date}{#id}) where code is written.

What is the best practice to execute a shell script with Chef between execute or bash resource ?

2 Answers
Related