Chef infra 如何从chef recipe运行bash脚本文件

Chef infra 如何从chef recipe运行bash脚本文件,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我想实现厨师食谱中的逻辑,如下所示。我怎样才能做到这一点 File=/tmp/productMain.param if [ -f "${File}" ]; then if [ -f /tmp/monitor.sh ]; then echo "[INFO] configuration beeing processed" /tmp/monitor.sh $File else error "The monitor script doe not exit exit

我想实现厨师食谱中的逻辑,如下所示。我怎样才能做到这一点

File=/tmp/productMain.param
if [ -f "${File}" ]; then
 if [ -f /tmp/monitor.sh ]; then
     echo "[INFO] configuration beeing processed"
     /tmp/monitor.sh $File
 else
    error "The monitor script doe not exit
    exit 1
 fi
else
  error "input file does not exist"
  exit 1
fi

看看Chef文档,它非常好,并给出了如何使用bash资源的示例:

您自己也尝试过吗?这不是一个免费的代码服务Hi Tensibai,谢谢你的快速回复。我是Ruby语言的新手。。file=ProductMain.param cookbook_file”/temp/monitor.sh“do source”monitor.sh“mode 0755 end执行”config Agent“do命令”sh/tmp/monitor.sh#{file}“end请更正此错误。”。。你的帖子,并善待他人,这不是有偿的支持。我们在空闲时间帮忙。请参阅关于感谢Wim和buruzaemon的通知,以获得您的快速回复。我是Ruby语言的新手。。file=ProductMain.param cookbook_file”/temp/monitor.sh“do source”monitor.sh“mode 0755 end执行”config Agent“do命令”sh/tmp/monitor.sh#{file}“end请更正此错误。”。。