Waarp R66-TaskOptions

We focus here on the several tasks that are possible to run before a transfer starts (pre action), after a transfer is finished correctly (post action) or after an error occurs (either in pre or post action or during transfer: error action).

 

Those actions are defined in one rule. Each rule contains 2 parts:

  1. Sender actions: A host is a Sender if it is the requester on a SEND rule or if it is the requested on a RECV rule.
  2. Receiver actions: A host is a Sender if it is the requester on a RECV rule or if it is the requested on a SEND rule.

Each action could be on pre, post or error step, each step can have several actions.

 

It is defined with a unified form of XML:

 

        <tasks>

          <task>

             <type>NAME</type>

             <path>path</path>

             <delay>x</delay>

          </task>

          <task>

             <type>NAME</type>

             <path>path</path>

             <delay>x</delay>

          </task>

      </tasks>

Each action is of one of the following items:

This task logs or writes to an external file some info:

Move the file to the path designed by Path and Transfer Information arguments without renaming the filename (same basename).

 

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

Delay is ignored.

 

The file is marked as moved.

Move the file to the path designed by Path and Transfer Information arguments.

 

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

Delay is ignored. 

 

The file is marked as moved.

Copy the file to the path designed by Path argument without renaming the filename (same basename).

 

Delay and Transfer Information are ignored.

 

The file is not marked as moved.

Copy the file to the path designed by Path and Transfer Information arguments.

 

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

Delay is ignored.

 

The file is not marked as moved.

Execute an external command given by Path and Transfer Information arguments.

 

The Delay is the maximum amount of time in milliseconds before the task should be considered as over time and so in error.

 

The command path is obtained from Path transformed according to above dynamic replacements, and after a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

The file is not marked as moved.

 

The external command is supposed to behave as the following for its exiting value:

Execute an external command given by Path and Transfer Information arguments.

 

The Delay is the maximum amount of time in milliseconds before the task should be considered as over time and so in error.

 

The command path is obtained from Path transformed according to above dynamic replacements, and after a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

The last line returned by the external command is interpreted as the new full file path. The external command is responsible to really move the previous file to the new one.

 

The file is marked as moved.

 

The external command is supposed to to behave as the following for its exiting value:

  • EXECOUTPUT

Execute an external command given by Path and Transfer Information arguments.

 

The Delay is the maximum amount of time in milliseconds before the task should be considered as over time and so in error.

 

The command path is obtained from Path transformed according to above dynamic replacements, and after a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

All lines returned by the external command (normal output) is interpreted as the possible error message in case of error.

 

The file is not marked as moved.

 

The external command is supposed to to behave as the following for its exiting value:

  • exit 0, for a correct execution

  • exit 1, for a warned execution (but however correct)

  • other exit values for a failed execution, for which the output (stdout) lines are used as error message, bring back to the remote host as #ERRORMSG# and #ERRORCODE# / #ERRORSTRCODE#

Execute an external Java class given by Path and Transfer Information arguments.

The Delay is the maximum amount of time in milliseconds before the task should be considered as over time and so in error.

 

The class name (which must implement R66Runnable) is obtained from Path transformed according to above dynamic replacements, and after a String Format where Transfer Information is used as input (String.format(Path,Info)). The first argument is this full classname. The allocation must be of the form new MyClass(), so an empty constructor.

 

The file is not marked as moved.

Submit a new transfer based on the Path and Transfer Information arguments.

 

The transfer arguments are obtained from Path transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

The result should be as r66send command except "-info" must be the last field:

"-file filepath -to requestedHost -rule rule [-md5] [-start yyyyMMddHHmmss or -delay (delay or +delay)] -info transferInformation"

where each field is separated by blank character. Last field (transferInformation) may contain however blank character.

 

Delay is ignored.

 

The file is not marked as moved.

Test if the current file is under one of the paths based on the Path and Transfer Information arguments.

 

The paths arguments are obtained from Path transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

The result should be as: "path1 path2 ..." where each path is separated by blank character.

 

If Delay is not 0, a log is printed out.

 

The file is not marked as moved.

This task deletes the current file.

 

The current file is no more valid.

 

No arguments are taken into account.

Create a link of the current file and make the file pointing to it.

 

The link first tries to be a hard link, then a soft link, and if it is really not possible (not supported by the filesystem), it does a copy and rename task.

 

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

Delay is ignored.

 

The file is not marked as moved.

 

Reschedule Transfer task to a time delayed by the specified number of milliseconds, if the error code is one of the specified codes and the optional intervals of date are compatible with the new time schedule

Result of arguments will be as following options (the two first are mandatory):

Each time this function is called, the limit value will be replaced as newlimit = limit - 1 in the "transfer information".

To ensure correctness, the value must be in the "transfer information" since this value will be changed statically in the "transfer information". However, a value must be setup in the rule in order to reset the value when the count reach 0.
So in the rule, "-count resetlimit" must be present, where resetlimit will be the new value set when the limit reach 0. If it is missing, the condition is not applied.



Note that if a previous called to a reschedule was done for this attempt and was successful, the following calls will be ignored.

Important note: any subsequent task will be ignored and not executed once the reschedule is accepted. On the contrary, if the reschedule is not accepted, the following tasks will be executed normally.

In case start > end, end will be +1 day

In case start and end < current planned date, both will have +1 day.


Example:

"-delay 3600000 -case ConnectionImpossible,ServerOverloaded,Shutdown -notbetween H7:m0:S0;H19:m0:S0 -notbetween H1:m0:S0;H=3:m0:S0 -count 1"

means retry in case of error during initialization of connection in 1 hour if not between 7AM to 7PM and not between 1AM to 3AM and with a limit of 3 retries (retry will be reset to 1 in case of 3 attempts).

Create a TAR from the argument as source and destination or UNTAR files from a TAR file.

 

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

Delay of 1 = UNTAR PATH="sourceFile targetDirectory"

 

Delay of 2 = TAR PATH="targetFile sourceDirectory"

 

Delay of 3 = TAR PATH="targetFile sourceFile1 sourceFile2..."

 

The current file is not touched.

Create a ZIP from the argument as source and destination or UNZIP files from a ZIP file.

 

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

 

Delay of 1 = UNZIP PATH="sourceFile targetDirectory"

 

Delay of 2 = ZIP PATH="targetFile sourceDirectory"

 

Delay of 3 = ZIP PATH="targetFile sourceFile1 sourceFile2..."

 

The current file is not touched.

Allow to transcode a file from a Charset to another one.

After Path is transformed according to above dynamic replacements, it is then used as a String Format where Transfer Information is used as input (String.format(Path,Info)).

  • "-from fromCharset"
  • "-to toCharset"
  • "-newfile filename" optional argument ; if not used, will be current filename.extension ; if used, extension is ignored
  • "-extension extension" optional argument ; if not used, will be filename.transcode

fromCharset and toCharset are string representations of the official charsets in Java.

  -dos2unix or -unix2dos allow to transform file after transcoding or even without any transcode (no -from -to specified)

A convenient method (from Waarp Common) allows to list in html (-html), csv (-csv) or text format (-text) all the supported Charsets from your JVM. To use it, run the following command:

java -cp WaarpCommon-1.2.7.jar org.waarp.common.transcode.CharsetsUtil [-csv | -html | -text ]

 

It could also be used as a test of transcode outside R66:

java -cp WaarpCommon-1.2.7.jar org.waarp.common.transcode.CharsetsUtil -from fromFilename fromCharset -to toFilename toCharset

 

The current file is not touched and is not marked as moved.

 

 

 

Example:

 

      <tasks>

     <task>

        <type>MOVE</type>

        <path>/pathout/</path>

        <comment>move the file to /pathout/#TRUEFILENAME#</comment>

        <delay>0</delay>

     </task>

     <task>

        <type>EXEC</type>

        <path>#HOMEPATH#/pathexec/monscript #TRUEFULLPATH# #ORIGINALFILENAME# #FILESIZE# #RULE# %s %d #REMOTEHOST#</path>

        <comment>information passed by transfer is "a_string_without_blank a_number" and replaced respectively in %s and %d</comment>

        <delay>30000</delay>

        <comment>maximum 30 seconds to execute this script</comment>

     </task>

   </tasks>