...
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.
- configure traps directly within the
- 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.
...
- 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.
- No effect: neither the shell job nor it's children receive a signal
- 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
- 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.
- configure traps directly within the
- 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 | ||||
---|---|---|---|---|
|
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 language xml title Workaround 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 | ||||
---|---|---|---|---|
|
Download the Example
...