Chef-solo从bash脚本获取日志 [英] chef-solo getting logs from a bash script

查看:86
本文介绍了Chef-solo从bash脚本获取日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过如下所示的厨师执行shell脚本

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

我的厨师日志定向到文件( log_location'/var/log/arkin/chef-run.log'

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

现在,我没有从bash脚本 psql10_migration.sh 中获取任何日志。有人可以让我知道如何从bash脚本获取日志吗?

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 ?

推荐答案

用于bash重定向,如下所示

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

这篇关于Chef-solo从bash脚本获取日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆