Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

They are to be found  the ./bin folder of the JUA installation.

The script for the operating system being used is called with the parameter -kill-agent-task-id=...  and

  • finds the process containing the ID specified and
  • kills the process including all child processes.

The JUA start script starts the Agent with the new -kill-script parameter as follows:

...

See  JS-1468 & JS-1495 for more detailed information.

Delimitation

  • This feature is intended for Unix platforms that implement the SIGTERM and SIGKILL signals. It is not intended for Windows platforms for which exclusively the Kill Immediately command applies.
  • When using traps then please consider that the process created by the <shell> element receives the signal. Subsequent scripts that are called within the <shell> element will not receive the signal. You could therefore:
    • configure traps directly within the <shell> element. The shell process will then receive and handle the signal.
    • configure traps in a shell script that is added by an <include> element instead of being stated within the <shell> element. The included shell script will receive and handle the signal.
    • forward signals to subsequent shell scripts that are called within a <shell> element.
  • This feature has been fully implemented on the Universal Agent and It has been implemented for classic JobScheduler Agents (JS-1420).

Implementation Summary

The implementation of the different termination operations available for the JobScheduler Master and Universal Agent is summarized in the table below.

...

  1. The child process continues: the shell job (and Java process if applicable) is killed, but the child process (sleep or ping - see attached jobs) is detached from the process tree and continues to run.
  2. No effect: neither the shell job nor it's children receive a signal
  3. The Java process is terminated but it's child process (the shell job script) and child processes thereof (sleep command) do not receive a SIGTERM signal
  4. 1.9.2-1.9.4 the kill comes too late, after the task has ended normally

Delimitation

  • This feature is intended for Unix platforms that implement the SIGTERM and SIGKILL signals. It is not intended for Windows platforms for which exclusively the Kill Immediately command applies.
  • When using traps then please consider that the process created by the <shell> element receives the signal. Subsequent scripts that are called within the <shell> element will not receive the signal. You could therefore:
    • configure traps directly within the <shell> element. The shell process will then receive and handle the signal.
    • configure traps in a shell script that is added by an <include> element instead of being stated within the <shell> element. The included shell script will receive and handle the signal.
    • forward signals to subsequent shell scripts that are called within a <shell> element.
  • This feature has been fully implemented on the Universal Agent and It has been implemented for classic JobScheduler Agents (JS-1420).

Workarounds

Workaround Title
Status
colourYellow
title???

  • Should job scripts not be able to catch signals by traps then you can use a monitor script, i.e. a post-processing script, that would be called by JobScheduler on receipt of a SIGTERM signal (JS-1463). For example:

    Code Block
    languagexml
    titleWorkaround for shell jobs with a timeout
    <job name="shell_with_javascript_monitor">
        <script  language="shell">
            <![CDATA[
    echo hello world!
    sleep 45
            ]]>
        </script>
    
        <monitor  name="process0" ordering="0">
            <script  language="java:javascript">
                <![CDATA[
    function spooler_process_before(){
    	return true;
    }
                ]]>
            </script>
        </monitor>
    
        <run_time />
    </job>

Examples

...

Examples

Using a SIGTERM trap to show the difference between the <kill_task> and <terminate_task> commands
Status
colourYellow
title???

Download the Example

job_trap_sigterm.job.xml.zip

...