Versions Compared

Key

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

...

The SSH Session Management adds the possibility to end orphaned remote processes started by SSH Jobs or jobs or orphaned JobScheduler tasks from SSH Jobsjobs.

Use Case

What happens if the connection to your remote host breaks while a script is still running? How can the JobScheduler job which started the remote script know about that?

...

Anchor
mode_of_operation
mode_of_operation
Mode Of Operation

To configure your SSH Job job to use the SSH Session Management you have to configure your SSH Job job and define a cleanup job chain for the cleanup work.

The feature requires the use of the JSch implementation by JCraft. See How To - Usage of the SSH Job (JobSchedulerSSHJob) with JCraft's JSch for more information about configuring your SSH Job job to use the JSch implementation,

...

  • if a remote process is running and the JobScheduler Task task is still alive:
    • do nothing, the cleanup job chain goes to a setback condition and waits for another start
  • if a remote process is running but the JobScheduler Task task is no longer available:
    • the cleanup job tries to end the process on the remote host
  • if a remote process is no longer available but the JobScheduler Task task is still running:
    • the cleanup job ends the Task task immediately
  • if a remote process and the JobScheduler Task task are not available anymore
    • do nothing, the cleanup job ends

...

Jira
serverSOS JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId6dc67751-9d67-34cd-985b-194a8cdc9602
keyJITL-112

Configuration of the SSH

...

job to be monitored

A number of additional parameters have to be added to the job configuration before the SSH Job job can be monitored:

runWithWatchdog

...

  • format:
    • <command> \${pid}
  • default value:
    • kill -15 \${pid}
  • description:
    • The command for terminating a process on the remote machine. This command depends on the OS of the remote host. If the command is not set, the cleanup Job job checks whether the remote host is running on a Linux or on a Windows system and uses the appropriate default commands.
      The ${pid} placeholder will be substituted by the cleanup job. Note that the leading $ character has to be escaped with "\".

...

The cleanup job chain consists of two jobs, one to read the pid of the connected shell from a temporary file on the remote host and one to check if the process or the JobScheduler Task task is still running. The temporary file will be generated automatically and deleted after processing. The second job also ends either the remote process or the JobScheduler task as appropriate.

...

The first job reads the pid from the temporary file on the remote host. If your SSH Job job is configured as described above, the temporary file will have been created automatically on the remote host.

...