方向舵:jobScheduler报告缺失

我在Debian 8.8服务器上运行Rudder服务器4.1.3。 我在Debian 8.8服务器上也有几个代理。

所有工作正常…除了jobScheduler报告。 我的日程安排工作的合规性报告缺失。

里面的日志,我看到:

5月27日10:16:14方向舵[26831]:CFEngine(代理)方向舵R:@@ jobScheduler @@ log_info @@ d62b28f4-4a9e-47f8-962a-2c1c86a0fb8d @@ 6ff2c3cd-e938-4590-b53d-adf395938507 @@ 1 @@ Job @@ NBPKG = $(apt-show-versions | grep upgradeable | wc -l); if [[$ NBPKG -ne 0]]; 然后回声1; 其他回声2; fi @@ 2017-05-27 08:16:12 + 00:00 ## f49080af-fb97-488c-8e97-5907c3dd4853 @#已启动作业(NBPKG = $(apt-show-versions | grep upgradeable | wc – l); if [[$ NBPKG -ne 0]];然后echo 1; else echo 2; fi),结果将在下次运行

但报告总是丢失。

你可以帮我吗 ?

谢谢。


正如你所build议的,我修改了这份工作。 我的新命令:

if [ $(/usr/bin/apt-show-versions | grep upgradeable | wc -l) -ne 0 ]; then false; else true; fi 

结果:

 [Unexpected] Job failed on last completed execution (if [ $(/usr/bin/apt-show-versions | grep upgradeable | wc -l) -ne 0 ]; then false; else true; fi) [Missing] [Unexpected] Job failed on last completed execution (if [ $(/usr/bin/apt-show-versions | grep upgradeable | wc -l) -ne 0 ]; then false; else true; fi) 

🙁

正如你所看到的,日志说“ 结果将在下次运行中报告” – 所以你粘贴的报告说,它只是运行的工作,但没有得到它的结果呢。 技术JobScheduler通常处于“Missing”状态,只要工作没有运行:我们还不知道它的状态,所以我们不能报告任何相关的

日志的严重性(@@之间的第二个文本)是log_info ,所以它仅用于信息,不用于合规性计算 – 合规性计算依赖于result_ *和audit_ *报告types。

最后,你运行的命令似乎不能在纯shell脚本中工作; 当试图运行它时,我得到以下错误: info: Executing 'no timeout' ... 'NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi' notice: Q: "...w-versions | gr": sh: 1: apt-show-versions: not found Q: "...w-versions | gr": sh: 1: [[: not found Q: "...w-versions | gr": 2 info: Last 3 quoted lines were generated by promiser 'NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi' info: Completed execution of 'NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi' info: Executing 'no timeout' ... 'NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi' notice: Q: "...w-versions | gr": sh: 1: apt-show-versions: not found Q: "...w-versions | gr": sh: 1: [[: not found Q: "...w-versions | gr": 2 info: Last 3 quoted lines were generated by promiser 'NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi' info: Completed execution of 'NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi'

您可能需要将apt-show-versions和echo(以及您使用的任何命令)的完整path放在安全的一边,而[[]]不是有效的/ bin / sh语法,因此错误(请参阅http://mywiki.wooledge.org/Bashism进行replace)。

问候,