Versions Compared

Key

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

Table of Contents

Introduction

  • The SSH (Secure Shell) SSHJob allows to execute shell code, scripts and programs on another host without a JS7 Agent being installed on that machine.
  • The SSHJob allows execution on Unix and Windows systems.
    • Unix based operating systems generally provide an SSH client, while Windows operating systems by default do not

...

The JobSchedulerSSHJob allows the execution of shell commands and scripts on a remote host running an SSH server without requiring a local SSH client to be installed.

...

    • .
  • The beauty of SSH is its simplicity. It allows public/private key authentication and is well suited to execute programs for specific accounts.
    • The JITL SSHJob allows shell scripts to add return values to orders.
  • One of the restrictions of SSH connections is that there is limited control of child processes on the remote host. 
    • If a number of child processes are spawned by a program during an SSH session and that session is aborted then child processes will continue to run.

Usage

When defining the job consider

  • to use the Wizard that is available from the job properties tab in the Configuration view,
  • to select the JITL job class and
  • to specify the com.sos.jitl.jobs.ssh.SSHJob Java class name.

...

  • Required Arguments
    • Arguments that have to be set in specified with the job configuration to run the job.
      • Example: The  host argument is required to run a job that connects to a remote host.
  • Optional Arguments
    • Arguments that are not required or arguments that are technically required but are available from a default valuevalues.
      • Example 1: technically required, but available from default value
        • To connect to a remote host, the  port arguments argument is required. The arguments argument is available from the default value 22, therefore the port argument does not have to be specified with the job argumentsis not required.
      • Example 2: not required
        • The proxy_host argument is used only if the job's connection makes use of a proxy.

The com.sos.jitl.jobs.ssh.SSHJJob class accepts the following arguments:


NameRequiredDefault ValuePurposeExample
hostyes

This argument specifies the hostname or IP address of the SSH server to which a connection is to be made.


user

yes

This argument specifies the user account to be used when connecting to the SSH server.


portno22

This argument specifies the port number of the SSH server.


auth_methodnopublickey

This argument specifies the

authorization

authentication method for the SSH server - the publickey and password methods are supported. The path name of the private key file

must be set in

is specified with the auth_file argument when the publickey

 authorization

 authentication method is used. If the private key file is secured by a password then this

must

has to be specified with the password argument.

The password for each user account using password authorization must be specified using the password argument. The authorization methods which are enabled

Available authentication methods depend on the SSH server configuration. Not all SSH server configurations support the password 

authorization

authentication method.


passwordno

This argument specifies the user account's password for

authorization

authentication by the SSH server and

must

has to be specified if the password

 authorization

 authentication method is specified

in

with the auth_method argument. 
Alternatively, this argument is used to specify the

secret

passphrase for a private key

passphrase

if

publickey authorization has been set in

the publickey authentication method is used with the auth_method argument.


auth_fileno

This argument specifies the path and name of a

user's

private key file used for

registration on

authentication with an SSH server. This argument

must

has to be specified if the publickey

 authorization

 authentication method

has been

is specified

in

with the auth_method argument. 
If the private key file is secured with a passphrase

,

then the passphrase 

argument hat

has to be

set

specified with the

passphrase

password argument.


command_delimiterno%%

Command delimiter characters

are

can be specified using this argument.

These

The delimiters are used in command arguments to separate multiple commands.

These

The commands can

then

be executed in separate SSH sessions.


commandno

This argument specifies a command that

is to

should be executed on the SSH server. Multiple commands can be separated by the command delimiter that is specified using the command_delimiter argument.


command_scriptno

This argument can be used as an alternative to commandcommand_delimiter and command_script_file. It contains script code

which

that will be

saved

stored to a temporary

(script-)

file on the remote host and will be executed

there

. The script can access task and order arguments by environment variables. Environment variable names are written in upper case

and have "SCHEDULER_PARAM_" as a prefix

letter. Order arguments with the same name overwrite

task

a job's arguments.


command_script_fileno

This argument can be used as an alternative to commandcommand_delimiter and command_script. It contains the name of a local

(script-)

file,

which

that will be transferred to the remote host and will be executed

there

. The script can access task and order arguments by environment variables. Environment variable names are written in upper case

and have "SCHEDULER_PARAM_" as a prefix

letters. Order arguments with the same name overwrite

task

the job's arguments.


Note

The SSH Job

is able to

can transfer a command script file to the remote machine only if SFTP is allowed on the remote SSH Server.


command_script_paramno

This argument contains an argument string that will be appended when a command_script or command_script_file is called.


proxy_hostno

The value of this argument is the host name or the IP address of a proxy used to

create

establish the connection to the SSH server. The use of a proxy is optional.


proxy_portno

This argument specifies the port number of the proxy if a proxy is used to

create

establish the connection to the SSH server.


proxy_userno

The value of this argument specifies the user account for

authorization

authentication by the proxy server if a proxy is used to connect to the SSH server.


proxy_passwordno

This argument specifies the password for the proxy server user account if a proxy is used to connect to the SSH server.

command_script_paramno

This argument contains a argument string which will be appended when a command_script or command_script_file is called.


ignore_errornofalse

If the value of this argument is set to true then execution errors caused by commands on the SSH server will be ignored. Otherwise such execution errors

for jobs and orders

are reported by the

Job Scheduler

Agent.


ignore_exit_codeno

This argument is used to specify one or more exit codes

which

that will not be

treated

considered as errors. Multiple exit codes can be defined using comma separated values or using ranges.

  • 2,3,4,100
  • 4,50-60,210-220
ignore_signalno

If the value of this argument is set to true then all signals on Unix systems that terminate the execution of a command on the SSH server will be ignored - if for example a command is terminated using kill. 
Note that by default the

Job Scheduler

Agent reports errors for commands that are terminated by signals.


ignore_stderrno

This job checks if any output to stderr has been created by a command that is

being

executed on the SSH server and reports

this

such output as an error. 
If the value is set to true then output to stderr will not be reported as an error by the

Job Scheduler

Agent.


simulate_shellno

If this value is set to true then a login to a shell is simulated to execute commands. Some scripts may cause problems if

a

no shell is

not

present.


simulate_shell_prompt_triggerno

The expected command line prompt. Using this prompt the job tries to find out if commands may be entered or have been carried out. If no prompt can be configured

,

then timeout arguments have to be used.


simulate_shell_inactiity_timeoutno

If this argument is set then the job will assume that the command has been carried out and that the shell is waiting for commands if no new characters are written to stdout or stderr after the given number of milliseconds.