Complex Examples


Source directory with date

In the following example we fetch files via HTTP with a date in the source directory.

      [directory]
      http://noaa/nccf/com/verf/prod/precip.%T-1d%tY%tm%td

         [dir options]
         do not remove
         store retrieve list
         time 20 8,9,14 * * *
         time 50 8 * * *

         [files]
         gfs_*

             [destination]

                  [recipient]
                  ftp://donald:secret@hollywood//home/user

                  [options]
                  archive 1
                  priority 5

If the current time is 08:20 on 1st March 2013, then AFD will go and try to download the files gfs_* from the remote directory com/verf/prod/precip.20130228 at the host noaa. The %T-1d has the effect to subtract 1 day from the current time.

Note the two time [dir options], that allow more possibilities in setting the time when to fetch files.

Target directory determined by external program

      [directory]
      /home/data

         [files]
         *.png
         *.jpg
         *.gif

             [destination]

                  [recipient]
                  ftp://donald:secret@hollywood//home/data/%e`date "+%Y-%m-%d"`/pics

                  [options]
                  archive 1
                  priority 5

By catching the output of a command being executed, one can determine the target directory. In this case this will insert the current date. Note that this is much more expansive since a external program always needs to be called. A much cheaper way would be as follows:

      [directory]
      /home/data

         [files]
         *.png
         *.jpg
         *.gif

             [destination]

                  [recipient]
                  ftp://donald:secret@hollywood//home/data/%tY-%tm-%td/pics

                  [options]
                  archive 1
                  priority 5

File decrypted with the extension stripped

Here an example on how one can decrypt a file and send it to a commercial SFTP running on Windows, hence the domain\id username style and the 'lock ~'. Thanks to Bill Welch for this example!

      [directory]
      /home/data

         [files]
         *.pgp

             [destination]

                  [recipient]
                  sftp://msft\\\bill@RETIRED//works/with/ntfs/bypass

                  [options]
                  lock ~
                  srename *.pgp *
                  exec gpg -a -o %s.dec -d %s; mv %s.dec %s

Copyright © 2013 - 2021 by H.Kiehl
Holger.Kiehl@dwd.de
Last updated: 15.06.2021
[red dot]Index [red dot]Home