如何从厨师配方运行bash脚本文件

问题描述:

我想实现下面的厨师配方中的逻辑。我怎样才能做到这一点如何从厨师配方运行bash脚本文件

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 
+0

你甚至尝试自己吗? SO是不是免费的代码服务 – Tensibai

+0

Tensibai嗨, 感谢您的快速reply.I是新的Ruby语言.. 文件= ProductMain.param cookbook_file“/temp/monitor.sh”做 源“monitor.sh” 模式0755 结束 执行“配置代理”做 命令“SH /tmp/monitor.sh#{}文件” 结束 请纠正这个.. –

+0

[编辑]你的帖子,并善待他人,这不是付费支持。我们帮助我们的空闲时间。查看http://docs.chef.io上的通知 – Tensibai

看看厨师的文档,这是非常好的,并给出了如何使用bash的资源例子:https://docs.chef.io/resource_bash.html

+0

感谢Wim和buruzaemon,为您的快速回复。我是Ruby语言的新手。 file = ProductMain.param cookbook_file“/temp/monitor.sh”do source “monitor.sh” 模式0755 结束 执行 “配置代理” 做 命令 “SH /tmp/monitor.sh#{}文件” 结束 请纠正这个.. –