我在使用 bash 属性时尝试实现 not_if
我正在尝试启动 WAS 部署管理器,但只有当它没有运行时,我才使用简单的 grep 命令来获取正在运行的进程的 pid,如下面的日志所示
#Start the DMGR process
bash "start-dmgr" do
user "root"
code %(#{node[:websphere][:was][:was_installLocation]}/bin/startManager.sh)
not_if ("ps -f|grep dmgr|grep -v grep| awk {'print $2'}")
end
以下是来自厨师客户端的调试日志
当 DMGR 进程 *运行时*
[2013-06-07T15:13:54-04:00] DEBUG: Skipping bash[was-install-fixpacks] due to not_if command `/apps/websphere/ws70/bin/versionInfo.sh -maintenancePackages | grep `echo /mnt/newInstallers/WAS/APARs/7.0.0.19-WS-WAS-IFPM73674.pak | awk -F '-' '{print $4}' | awk -F '.' '{print $1}'``
Recipe: WAS_NPE::was_startdmgr
* bash[start-dmgr] action run[2013-06-07T15:13:54-04:00] INFO: Processing bash[start-dmgr] action run (WAS_NPE::was_startdmgr line 2)
1973
(skipped due to not_if)
当 DMGR 进程 * 未运行*
[2013-06-07T15:31:03-04:00] DEBUG: Skipping bash[was-install-fixpacks] due to not_if command `/apps/websphere/ws70/bin/versionInfo.sh -maintenancePackages | grep `echo /mnt/newInstallers/WAS/APARs/7.0.0.19-WS-WAS-IFPM73674.pak | awk -F '-' '{print $4}' | awk -F '.' '{print $1}'``
Recipe: WAS_NPE::was_startdmgr
* bash[start-dmgr] action run[2013-06-07T15:31:03-04:00] INFO: Processing bash[start-dmgr] action run (WAS_NPE::was_startdmgr line 2)
(skipped due to not_if)
不管是什么情况,它总是跳过,我错过了什么