Page History
...
- The job is configured with a timeout setting: if job execution exceeds the timeout then the job will be killed by the Agent.
- Jobs can be killed by use of the GUI operation and and by use of the JS7 - REST Web Service API:
- The cancelCancel/killKill operation kills a running job and fails the order.
- The suspendSuspend/killKill operation kills a running job and suspends the order.
- Failed and suspended orders can be resumed.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/bash # define trap for script completion trap 'JS7TrapOnExit' EXIT JS7TrapOnExit() { rc=$? echo "($(date +%T.%3N)) $(basename $0): JS7TrapOnExit: waiting for completion of child processes ..." wait exit $rc } # create three child processes sleep 100 & sleep 110 & sleep 120 & # this is what the script normally should do: # echo "waiting for completion of child processes" # wait echo "script completed" |
...
- Line 4: defines the trap calling the
JS7TrapOnExit()
function in case of theEXIT
event.EXIT
is a summary for a number of signals that terminate a script, however, this is available for the bash shell only. For use with other shells users instead have to state the list of signals such asTERM
,INT
etc. - Line 6 - 1012: implements the
JS7TrapOnExit()
function including thewait
command to wait for termination of child processes or otherwise to immediately continue.- The exit code returned from the trap is reported by the task log and order log.
- However, job execution will be considered failed independently from its the exit code value as the Cancel/Kill or Suspend/Kill operation was performed.
- Line 15-17Line 13-15: starts background processes.
- Line 19: 21 a script normally should
wait
for child processes, however, if this cannot be guaranteed, for example ifset -e
is used to abort a script in case of error, then use of a trap is an appropriate measure.
...
Overview
Content Tools