I am running Rudder server 4.1.3 on a Debian 8.8 server. I have several agent on Debian 8.8 server too.
All works fine ... except jobScheduler report. Compliance Report of my schedule job is missing.
Inside logs, i see :
May 27 10:16:14 rudder[26831]: CFEngine(agent) rudder 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 ]]; then echo 1; else echo 2; fi@@2017-05-27 08:16:12+00:00##f49080af-fb97-488c-8e97-5907c3dd4853@#Job has been launched (NBPKG=$(apt-show-versions | grep upgradeable | wc -l);if [[ $NBPKG -ne 0 ]]; then echo 1; else echo 2; fi), result will be reported on next run
but report is always missing.
Can you help me ?
thx.
As you suggest, I modified the job. My new command:
if [ $(/usr/bin/apt-show-versions | grep upgradeable | wc -l) -ne 0 ]; then false; else true; fi
Result:
[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)
:-(
As you can see, the log says "result will be reported on next run" - so the report you pasted says that it just ran the job, but didn't get it outcome yet. Technique JobScheduler is typically in "Missing" status as long as the job didn't run: we don't know yet its state, so we can't report anything that would be relevant
The severity of the log (the second text between the @@) is log_info, so it's only for information, not used in compliance computation - the compliance computation relies on result_* and audit_* reports types.
Finally, the command you run does not seems to work in plain shell script; when trying to run it, I get the following errors:
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'
You probably need to put the full path to apt-show-versions and echo (and any command you are using) to be on the safe side, and the [[ ]] is not a valid /bin/sh syntax, hence the error (see http://mywiki.wooledge.org/Bashism for replacement).
Regards,