2016-07-28 75 views
0

我想實現下面的廚師配方中的邏輯。我怎樣才能做到這一點如何從廚師配方運行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

回答

1

看看廚師的文檔,這是非常好的,並給出瞭如何使用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#{}文件」 結束 請糾正這個.. –