如何根据 bash 命令的输出包含厨师食谱?

How to include a chef recipe based on the output from bash command?

我想获取特定进程的计数,并仅在没有进程时包含配置配方。

类似的东西。这在厨师那里怎么可能?

if !( "(ps aux | grep splunkd | grep -v grep | wc -l) > 0 ") 
  include_recipe 'platform::splunk_config' 
end

我可以提供一个使用 ruby_block resourece in a conjunction with a guard 的想法,它应该是这样的:

ruby_block 'splank configuration' do
  block { include_recipe 'platform::splunk_config' }
  not_if "ps aux | grep splunkd | grep -v grep | wc -l > 0"
end

但我还没试过:)