chef-solo getting logs from a bash script

戏子无情 提交于 2019-12-25 02:21:54

问题


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 ?


回答1:


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


来源:https://stackoverflow.com/questions/51307728/chef-solo-getting-logs-from-a-bash-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!