Details
-
Fix
-
Status: Known Issue (View Workflow)
-
Minor
-
Resolution: Works as designed
-
1.8
-
None
Description
Current Situation
- When running a shell script in a shell job, then the output to stdout is not visible with the state text of the job.
- Setting the state text with API methods has no effect.
Desired Behavior
- When a shell job writes output to stdout, then the first line of the output created should be visible with the state text of the job.
- Setting the state text to some value using API methods should work..
- The behavior for shell jobs and API jobs works when using the JobScheduler Master and Universal Agent to execute jobs.
<job > <script language="shell"> <![CDATA[ echo hello world ]]> </script> <monitor name="state_text" ordering="0"> <script language="java:javascript"> <![CDATA[ function spooler_process_after(spooler_process_result){ spooler_job.state_text=spooler_job.name + " terminated"; return spooler_process_result; } ]]> </script> </monitor> <run_time /> </job>
Maintainer Notes
- The behavior of JobScheduler is correct. The above example does not switch off Windows command logging. When logging commands then Windows would start by writing an empty line, which is the reason why no output is visible with the state text of the job.
- The same behavior applies when using API methods to set the state text of a job. As the above example makes use of a shell job that logs to stdout, the output of that job (an empty line) is added to the state text.
- Consider use of command logging with jobs:
- Using echo results in command logging and writes an empty line to the state text of the job.
- Using @echo off will switch off command logging and will result in the desired behavior.