Display feature availability | ||
---|---|---|
|
The SSH Session Management adds the possibility to end orphaned remote processes started by a SSH Job or orphaned JobScheduler tasks of a SSH Job.
Mode Of Operation
To use the SSH Session Management you have to configure your SSH Job and define a second job chain for the cleanup work.
...
- format:
<command> \${pid}
- default value:
kill -9 \${pid}
- description:
- The command to kill a process on the remote machine. The command depends on the OS of the remote host. If the command is not set, the cleanup job checks whether the remote host is running on a Linux or on a Windows system and uses the relevant appropriate commands.
The${pid}
placeholder will placeholder will be substituted by the cleanup job. Note that the leading $ character has to be escaped with "\".
- The command to kill a process on the remote machine. The command depends on the OS of the remote host. If the command is not set, the cleanup job checks whether the remote host is running on a Linux or on a Windows system and uses the relevant appropriate commands.
...
- 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 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 placeholder will be substituted by the cleanup job. Note that the leading $ character has to be escaped with "\".
- 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 checks whether the remote host is running on a Linux or on a Windows system and uses the appropriate default commands.
...
- format:
<command> \${pid} \${user}
- default value:
/bin/ps -ef | grep \${pid} | grep \${user} | grep -v grep
- description:
- The command or script checks if the process on the remote host is still running. The cleanup job expects an exitcode = 0 if the process is still running or other than 0 if the process is not available anymore. The command or script depends on the OS of the remote host. If the command is not set, the cleanup Job checks whether the remote host is running on a Linux or on a Windows system and uses the appropriate default commands.
The${pid}
and${user}
placeholders placeholders will be substituted by the cleanup job. Note that the leading $ character has to be escaped with "\". - Example commands:
/bin/ps -ef
- writes all running processes to stdout on the remote host
| grep \${pid}
- filters the result to show only results containing the given ${pid}
- filters the result to show only results containing the given ${pid}
| grep \${user}
- filters the result to show only results containing the given ${user}
| grep -v grep
- filters the grep command itself
- filters the grep command itself
- The command or script checks if the process on the remote host is still running. The cleanup job expects an exitcode = 0 if the process is still running or other than 0 if the process is not available anymore. The command or script depends on the OS of the remote host. If the command is not set, the cleanup Job checks whether the remote host is running on a Linux or on a Windows system and uses the appropriate default commands.
...
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 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.
Job 1: The read-pid-from-temporary-file-Job
The first job reads the pid from a the temporary file on the remote host. If your SSH Job is configured as described above, a the temporary file will have been created on automatically on the remote host. Was ist der Bedeutung v. d. temp file?
Configure the Class of the Job in JOE like this:
...