FTP file to Cloverleaf

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf FTP file to Cloverleaf

  • Creator
    Topic
  • #48804
    Nicole Goodyear
    Participant

    Hi,

    I was wondering if anyone has any knowledge with sending files using ftp to Cloverleaf?  We are looking to get a file from our inventory system onto our AIX box and somehow using a cronjob to ftp this file to a thread on our engine to process it into an HL7 message and send to another system.  Any ideas, suggestions or help would be greatly appreciated!

Viewing 2 reply threads
  • Author
    Replies
    • #59766
      Bill Bertera
      Participant

      Nicole Goodyear wrote:

      Hi,

      I was wondering if anyone has any knowledge with sending files using ftp to Cloverleaf?  We are looking to get a file from our inventory system onto our AIX box and somehow using a cronjob to ftp this file to a thread on our engine to process it into an HL7 message and send to another system.  Any ideas, suggestions or help would be greatly appreciated!

      You would need to setup an ftp service on your Cloverleaf server, it wouldn’t have anything to do with the cloverleaf application. After its been FTP’d to your Cloverleaf server, then a thread could read it from that directory.

    • #59767
      Glenn Friedenreich
      Participant

      Hi Nicole –

      An alternative to “pushing” the files to your AIX/Cloverleaf host via ftp would be to “pull” the files from the source system into an AIX directory for subsequent Cloverleaf processing (if needed).

      If the source file resides on a host running ftp server, you can use ftp to ‘get’ the files from the source.  Also handy is the samba client, smbclient, available for AIX, which will allow you to ‘get’ files from Windows-based systems using ftp-style commands.

      smbclient is especially useful if your source host is a Windows PC that is not running ftp server.  Having control of the transfers residing on the AIX box enables you to easily script and automate the transfer process.

      – Glenn

    • #59768
      Russ Ross
      Participant

      I like to do what Glen suggested and pull the files across via FTP/get.

      You could use the FTP protocol built in the engine and have cron start the Cloverleaf process and/or threads.

      I typically use a k-shell script invoked by cron to do FTP/gets.

      The same k-shell scripting concept is also applicable to OpenSSH SFTP/gets.

      My entire FTP/get script might have a distracting amount of other bells and whistles so here is a k-shell code snippet to illustrate just the FTP/get part

      Code:

      ftp -inv <<- ! >> $local_ftp_log_file
         open $host_name
         user $user_id $pass_word
         $transfer_mode
         cd $remote_dir
         pwd
         dir
         lcd $local_dir
         mget $remote_file
         bye
      !

      Once you have determined the file(s) have been pulled across successfully then you mihgt want to do an FTP/delete to clear them off the source system, so here is an example of that k-shell code snippet

      Code:

      ftp -inv <<- ! >> $local_ftp_log_file
         open $host_name
         user $user_id $pass_word
         cd $remote_dir
         pwd
         dir
         mdelete $remote_file
         pwd
         dir
         bye
      !

      I warn you against assuming FTP is fool proof and advise you put methods in place to make sure your files are delivered and not lost or truncated.

      The simplest way is to check for a trailer record in the file that at least tells you how many records are in the file and confirm they match.

      Since people often hand edit FTP files, I even do some basic data validation of the files when possible.

      Given my preference, I would have the source system create a companion check sum file that would be used to make sure the file was complete and had not been tampered with.

      Russ Ross
      RussRoss318@gmail.com

Viewing 2 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10