You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Introduction


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.


This document describes the functionality of the JobSchedulerSSHJob and the arguments to configure the Job. Additionally this document provides a minimal example of an SSH Job configuration.

Usage

When defining the job consider

  • to select the JITL job class and
  • to specify the com.sos.jitl.jobs.ssh.SSHJob Java class name.


Example

A minimal SSHJob configuration can look like this:


Arguments

  • Required Arguments
    • Arguments that have to be set in 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 value.
      • Example 1: technically required, but available from default value
        • To connect to a remote host, the  port arguments is required. The arguments is available from the default value 22, therefore the port argument does not have to be specified with the job arguments.
      • 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

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


user

yes

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


portno22

specifies the port number of the SSH server.


auth_methodnopublickey

This argument specifies the authorization method for the SSH server - the publickey and password methods are supported. The path name of the private key file must be set in the auth_file argument when the publickey authorization method is used. If the private key file is secured by a password then this must 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 depend on the SSH server configuration. Not all SSH server configurations support the password authorization method.


passwordno

This argument specifies the user account password for authorization by the SSH server and must be specified if the password authorization method is specified in the auth_method argument. 
Alternatively, this argument is used specify the secret key passphrase if publickey authorization has been set in the auth_method argument.


auth_fileno

This argument specifies the path and name of a user's private key file used for registration on an SSH server. This argument must be specified if the publickey authorization method has been specified in the auth_method argument. 
If the private key file is secured with a passphrase, the passphrase argument hat to be set with the passphrase.


command_delimiterno%%

Command delimiter characters are specified using this argument. These delimiters are used in command arguments to separate multiple commands. These commands can then executed in separate SSH sessions.


commandno

This argument specifies a command that is to 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 will be saved to a temporary (script-)file on the remote host and 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. Order arguments with the same name overwrite task 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 will be transferred to the remote host and 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. Order arguments with the same name overwrite task arguments.


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


proxy_hostno

The value of this argument is the host name or the IP address of a proxy used to create 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 the connection to the SSH server.


proxy_userno

The value of this argument specifies the user account for authorization 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.


ignore_exit_codeno

This argument is used to specify one or more exit codes which will not be treated 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 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 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.


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 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, timeout arguments have to be used.


simulate_shell_inactiity_timeoutno

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





  • No labels