Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Scope
- Worum geht es? In einem Satz.
- The functions for terminating task processes by for the JobScheduler Master and Universal Agent have been extended to allow the use of both SIGTERM and SIGKILL signals on Unix servers.
- Für welches Release? (Confluence Macro display_feature_availablity)
Feature History
This feature was introduced with Release 1.9.0.
- :
- SIGTERM is sent first and allows an orderly termination of task processes to take place within a limited period of time.
- If the time allowed has been exceeded and the processes are still running then SIGKILL will be sent.
- The information contained in this article draws together detailed information contained in a range of issues and should primarily be of interest to persons in engineering and to a lesser extent persons in operating functions.
Feature History
Display feature availability | ||
---|---|---|
|
Related Issues
Support of this feature is subject to the following issues:features:
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1495 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1468 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1463 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
...
serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1421 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1420 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1382 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1307 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
...
serverId 6dc67751-9d67-34cd-985b-194a8cdc9602
...
Use Case
- Welche Rolle ist für den Fall verantwortlich? Wer will etwas? Engineering, Operating, Business
- Was ist das Ziel? Was ist das Mittel? Was ist die Motivation?
Implementation
- Wie ist die Lösung implementiert? Mit welchen Mitteln?
key JS-1163 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JOC-10
Use Case
Users who schedule programs and scripts that are aware of SIGTERM signals can implement clean-up procedures on receipt of the signal. Clean-up includes e.g. removal of temporary files, disconnect from a database and similar tasks.
- The use of both SIGTERM and SIGKILL signals on Unix servers has the following advantages:
The use of SIGTERM before SIGKILL means that there is a greater chance of data being saved after after the the kill command signal has been issued.
The SIGTERM signal can - in contrast with SIGKILL - be monitored, i.e. a prepost-/postprocessing processing Script can be carried out. This means that the ending of a task by the JobScheduler can be reacted to and the sudo User process itself can be ended.
- The post-processing methods implementation of SIGTERM allows post-processing methods such as
spooler_process_after
to complete within the timeout period()
.
The time allowed between the SIGTERM and the SIGKILL signals can be specified in the command using the timeout attribute (the default is 15 sec) - :
<kill_task … timeout=".."/>
- This feature can also be applied for:
- remote processes - , i.e. processes started by SSH and those started by an agentAgent,
- child processes started by a process running on an agent (
).Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1468
Implementation
...
JobScheduler Master
The following operations can be carried out from the JobScheduler Operating Center interface (JOC) or by use of the command line:
- Operation: kill immediately
- JOC sends
<kill_task immediately="yes"/>
- The process is killed immediately using the SIGKILL signal.
- JOC sends
- Operation: terminate with timeout
- JOC sends
<kill_task immediately="yes" timeout="15"/>
- The process receives a SIGTERM signal. Should that process not terminate within the specified timeout period then it will be killed with a SIGKILL signal.
- JOC sends
- Operation: terminate
- JOC sends
<kill_task immediately="yes" timeout="never"/>
- The respective process receives a SIGTERM signal. No monitoring Monitoring of the process termination of that process as described in operation 2) is performed.
- The process receives a SIGTERM signal. Monitoring of the process termination as described in operation 2. is not carried out.
- JOC sends
Delimitation
...
- Operation 2 above is not carried out.
See also
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JOC-10
JobScheduler Universal Agent (JUA)
The JobScheduler Universal Agent uses a script to monitor and kill parent and child tasks.
The script is to be found the ./bin
folder of the JUA installation.
The -kill-script option can be used to specify a different kill script if necessary. See the Command Line Options section in JobScheduler Universal Agent - Installation & Operation for more information.
See also
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1468 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1495
for more detailed information about the implementation.
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 kill Immediately command applies.
- When using traps then please consider that the process created by the
<shell>
the<script ... language="shell"/>
element receives the signal. Subsequent scripts that are called within the<shell>
<script ... language="shell"/>
element will not receive the signal.
You could therefore:- configure traps directly within the
<shell>
<script ... language="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>
the<script ... language="shell"/>
element. The included shell script will receive and handle the signal. - forward signals to subsequent shell scripts that are called within a
<shell>
<script ... language="shell"/>
element.
- configure traps directly within the
- This feature has been fully implemented on for the Universal Agent . It has been implemented for classic and for the Classic JobScheduler Agents using TCP ((
).Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JS-1420
Workaround
A monitor (i.e. a pre-/postprocessing script) has to be configured for shell jobs that have a timeout set (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>
Example
...
- Code Beispiel via Confluence Code Macro
...
Implementation Summary
The implementation of the different termination operations available for the JobScheduler Master and Universal Agent is summarized in the table below.
The links lead to the issues relevant to the implementation of the feature.
The termination operations available are:
- Terminate:
<kill_task immediately="true" timeout="...">
- Kill:
<kill_task immediately="true">
- Timeout: a job with the timeout attribute.
Windows Standalone | Linux Standalone | Windows Classic Agent | Linux Classic Agent | Windows Universal Agent | Linux Universal Agent | |
---|---|---|---|---|---|---|
Shell job | ||||||
Terminate | not supported | not supported | not supported | |||
Kill | ||||||
Timeout | ||||||
Shell job with monitor | ||||||
Terminate | not supported | not supported | not supported | |||
Kill | ||||||
Timeout | ||||||
API job | ||||||
Terminate | not supported | not supported | not supported | |||
Kill | ||||||
Timeout |
Task Termination in JOC
The following screenshot shows how a task can be terminated using the Task menu in JOC's Task pane. This pane is shown in the Jobs tab when the task is running and the task can be terminated either with timeout or immediately.
Examples
Using a SIGTERM trap to show the difference between the kill
and terminate
commands
Download the Example
Description
This example contains a job that uses a sigterm SIGTERM trap to show the difference between the kill<kill_
task task>
and terminate<terminate_
task task>
commands provided by JOC.
The job job_trap_sigterm.job.xml
shows how to trap the terminate command provided by JOC.
- Start the job
- Terminate the task in JOC
- You will see the log message:
sigterm will be ignored
The task will continue
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="ISO-8859-1"?>
<job title="test test">
<script language="shell">
<![CDATA[
trap 'echo sigterm will be ignored' 15
for i in 1 2 3 4 5 6 7 8 9 0
do
date
sleep 10
done
sleep 60
]]>
</script>
<run_time />
</job> |
Additional resources
...
Change Management References
...
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
References
- JobScheduler Reference Documentation: