tuk
tuk

Reputation: 6872

chef-solo getting logs from a bash script

I am executing a shell script via chef like below

execute 'Run postgres data migration' do
  command '/home/ubuntu/build-target/infra-base/psql10_migration.sh'
  live_stream true
  action  :run
  only_if { ::File.exist?('/home/ubuntu/build-target/infra-base/psql10_migration.sh') }
end

My chef logs are directed to a file (log_location '/var/log/arkin/chef-run.log' )

Right now I am not getting any logs from the bash script psql10_migration.sh. Can someone let me know how can I get the logs from the bash script ?

Upvotes: 2

Views: 312

Answers (1)

tuk
tuk

Reputation: 6872

Used in bash redirection like below

execute 'Run postgres data migration' do
  command '/home/ubuntu/build-target/infra-base/psql10_migration.sh >> /home/ubuntu/logs/psql10-migration.log 2>&1'
  action  :run
  only_if { ::File.exist?('/home/ubuntu/build-target/infra-base/psql10_migration.sh') }
end

Upvotes: 1

Related Questions