【问题标题】:chef-solo getting logs from a bash scriptchef-solo 从 bash 脚本中获取日志
【发布时间】:2018-07-16 16:58:30
【问题描述】:

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

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')

现在我没有从 bash 脚本 psql10_migration.sh 获得任何日志。有人可以告诉我如何从 bash 脚本中获取日志吗?

【问题讨论】:

    标签: ruby chef-solo


    【解决方案1】:

    用于 bash 重定向,如下所示

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-07
      相关资源
      最近更新 更多