Simple Examples


Example 1

An example entry in the DIR_CONFIG file might look as follows:

      [directory]
      /usr/data/tmp

           [files]
           abc*

                [destination]

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

                     [options]
                     archive 3
                     priority 1

The result of this entry would be that all files starting with abc in the directory /usr/data/tmp would be send to the user donald via FTP with the password secret at hollywood and there stored in the directory /home/user. They will also be send to daisy via SMTP. All files will be send with the priority 1 and will be archived for three days. The ftp files will be send with a dot first and only when a file is completely transmitted will it be renamed to its original name.

There are several ways to specify a source directory. The following examples all result to the same directory:

      [directory] don_in
      /home/donald/data/in
      [directory] don_in
      ~donald/data/in
      [directory] don_in
      file://home/donald/data/in
      [directory]
      file://donald@don_in/data/in

don_in is the directory alias name. If this is not set AFD will assign one for it that will be CRC32 checksum of the directory string. This is not human readable, so if you want to see readable directory alias names in dialog dir_ctrl, set them.

Example 2

In the following example we want different options when we send mails to daisy. For this we need to split the two recipients so that each have their own options as follows:

      [directory]
      /usr/data/tmp

           [files]
           abc*

                [destination]

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

                     [options]
                     archive 3
                     priority 1

                [destination]

                     [recipient]
                     mailto://daisy@hollywood

                     [options]
                     archive 3
                     attach file
                     priority 1

Now daisy gets the same files as in example 1 only this time the files are attached.

Example 3

If daisy should get more files we need to split up the above example another time:

      [directory]
      /usr/data/tmp

           [files]
           abc*

                [destination]

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

                     [options]
                     archive 3
                     priority 1

           [files]
           abc*
           def*
           ghi*
           jkl*

                [destination]

                     [recipient]
                     mailto://daisy@hollywood

                     [options]
                     archive 3
                     attach file
                     priority 1

Daisy will now also get the additional files def*, ghi* and jkl*.

Example 4

The source directory for files can also be on another host. For this we just need to change the directory entry as follows:

      [directory]
      ftp://micky:mouse@ducktown//usr/data/tmp

           [files]
           abc*

                [destination]

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

                     [options]
                     archive 3
                     priority 1

The result of this entry will be similar to the one in example 1, only that in this example AFD will look every minute on the host ducktown in the directory /usr/data/tmp for the files.

If we do not like AFD to delete the files on the remote we can tell it via the [dir options] to not remove the files on the remote host:

      [directory]
      ftp://micky:mouse@ducktown//usr/data/tmp

           [dir options]
           do not remove

           [files]
           abc*

                [destination]

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

                     [options]
                     archive 3
                     priority 1

Now AFD will collect the same files every minute and send them to donald and daisy. If one does not wish to send the same files again one can add the following option:

      [directory]
      ftp://micky:mouse@ducktown//usr/data/tmp

           [dir options]
           do not remove
           store retrieve list

           [files]
           abc*

                [destination]

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

                     [options]
                     archive 3
                     priority 1

With the option store retrieve list only new files or those where the date and/or size has changed will be collected. If one wants to increase the poll interval from 1 minute to 30 minutes, it needs to be done as follows:

      [directory]
      ftp://micky:mouse@ducktown//usr/data/tmp

         [dir options]
         do not remove
         store retrieve list
         time */30 * * * *

         files]
         bc*

             [destination]

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

                  [options]
                  archive 3
                  priority 1

Example 5

If the source directory on the remote host cannot supply a directory listing and only deliver a certain filename like for example a web cam one needs to set the directory option do not get dir list as shown below:

      [directory]
      http://tick:cam_secret@webcam/pics

         [dir options]
         do not remove
         do not get dir list
         time */10 * * * *

         [files]
         gif

             [destination]

                  [recipient]
                  sftp://tick:secret@hollywood/cam

                  [options]
                  srename gif garden-%tH-%tM.gif
                  priority 5

Most remote web services cannot handle wild cards. So ensure that you do not specify them under [files].

If the remote resource is generating a filename (delivers via the HTTP header a 'Content-Disposition Field') at the time of the request one needs to use the url creates file name option instead of 'do not get dir list':

      [directory]
      http://tick:cam_secret@webcam/pics/gif

         [dir options]
         do not remove
         url creates file name
         time */10 * * * *

         [files]
         *

             [destination]

                  [recipient]
                  sftp://tick:secret@hollywood/cam

                  [options]
                  srename gif garden-%tH-%tM.gif
                  priority 5

Because the filename is generated at the time of the request, you do not know what file name will be delivered, so it is best to just specify '*' under [files].


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