Difference between revisions of "OS4X plugin os4xplugin scp upload"

From OS4X
Jump to navigation Jump to search
 
Line 52: Line 52:
 
Starting with OS4X release 2021-06-15, the following variable is also available:
 
Starting with OS4X release 2021-06-15, the following variable is also available:
 
*%A: job year (short, two digits)
 
*%A: job year (short, two digits)
 +
 +
Since OS4X 3 Build 20211130 the following variable is available:
 +
*%%: represents the character "<code>%</code>"
  
 
== Beispiele ==
 
== Beispiele ==

Latest revision as of 14:30, 30 November 2021

Purpose

For simple SCP/SFTP upload tasks, this plugin can transfer all job files to a target SCP/SFTP server.

Configuration

The plugin must be configured on per-partner level and has no global configuration.

Configuration parameters are:

  • Target server: server hostname or IP address of SSH server being addressed.
  • SCP port: default port 22, but can be changed to any valid TCP/IP port on which the remote SSH server is listening.
  • Target path: target path where to upload files to.
  • Username: username which is being authentificated at the remote server.
  • Password: plaintext password (if available) for the user being authentificated.
  • Key file: absolute path to the SSH key file of the user being authentificated.
  • Debug output: enable more debug output for analyzing transmission problems.
  • Enable SCP mode: If SFTP is not available, plain SCP mode can be activated with this option. Beware: enabling this option disabled the support of directory structures on remote site.
  • SFTP upload with temporary filename: in SFTP mode, the plugin uploads the file with a dot (".") prefix and renames it afterwards. The target filename must not exist on the target server in the configured path.

The target directory may contain variables, which are resolved at runtime of the plugin. The list of usable variables is:

  • %j: job number
  • %d: day of job creation (two digits)
  • %m: month of job creation (two digits)
  • %Y: year of job creation (four digits)
  • %H: hour of job creation (two digits, 24h format)
  • %M: minute of job creation (two digits)
  • %S: second of job creation (two digits)
  • %D: job direction (either "incoming" or "outgoing")
  • %r: recipient partner shortname
  • %s: sender partner shortname
  • %t: recipient location
  • %u: recipient department
  • %v: recipient name
  • %w: recipient last name
  • %x: recipient address code
  • %g: sender location
  • %h: sender department
  • %i: sender name
  • %J: sender last name
  • %k: sender address code
  • %e: depending on the job direction, the partner shortname of the external communication partner
    • for incoming jobs: sender partner shortname (see "%s")
    • job outgoing (or undefined job directions): recipient partner shortname (see "%r")
  • %a: ENGDAT Message Reference [UNH0062] (if given, otherwise empty)
  • %b: ENGDAT Document Number [MID1004] (if given, otherwise empty)

Since OS4X 3 Build 20180129 the following variables are available:

  • %p: sender partner's event parameter
  • %P: recipient partner's event parameter
  • %Q: depending on the job direction, the event parameter of the external communication partner:
    • incoming jobs: sender's event parameter (= "%p")
    • outgoing jobs or undefined job direction: recipient's company shortname (= "%P")

Starting with OS4X release 2021-06-15, the following variable is also available:

  • %A: job year (short, two digits)

Since OS4X 3 Build 20211130 the following variable is available:

  • %%: represents the character "%"

Beispiele

Alle Beispiele basieren auf einem OS4X-Sendeauftrag mit der Nummer 76 von und an Firma "c-works"

/opt/os4x/tmp/%r/os4x_job_%j/

wird zu:

/opt/os4x/tmp/c-works/os4x_job_76

/opt/os4x/tmp/%D/%r/%j

wird zu:

/opt/os4x/tmp/outgoing/c-works/76

Ein SWAN-ähnliches Konstrukt wäre z.B.:

/opt/os4x/data/%Y/%m/%d/%j

welches aufgelöst wird zu:

/opt/os4x/data/2008/03/18/76


Behaviour

The plugin loops over all files of the job and handles them separately (one after another). For each file, the plugin

  • Connects to the SSH server
  • Uploads the file to the target directory with its absolute filename. The local filename is being analyzed if a "job directory" exists for this job. If it exists, the file is being translated into a path without the job directory, so subdirectories at remote side are possible (i.e. when extracting a ZIP archive with subdirectories before transmission). If no job directory definition exists, the basename of the file is being used.