[SUMMARY] Knowing EOT or EOF from a shell script

From: Osama Ahmed (osama_at_myrealbox.com)
Date: 08/29/03

  • Next message: accy guy: "shell question"
    To: <sunmanagers@sunmanagers.org>
    Date: Fri, 29 Aug 2003 12:43:50 +0200
    
    

    Sorry for being late (Summer Times!!).
    Credits to:
     - Bruntel, Mitchell L, ALABS
     - Jay Lessert
     - Crist Clark
     - Reggie Beavers
     - Hichael Morton
     - Tim ttg
     - Smith, Kevin

    - General consensus is to use fuser/lsof to see if ftp/rcp is using
      the file FEED1 or not. If not then most probably the transfer is
      finished. This only if the file is being written by a local
      process (ftpd, rshd, sshd), lsof/fuser will tell you when the
      file is not open any more. If the file is being written over NFS
      the open file handle is on the other host.

    - No EOF character actually appears in a file, unless
      these are special files that you happen to know the format for

    - It would be best if the sending application also dropped a
      signature file containing that information after it finished
      sending the payload file.

    - What about checking file-size, sleep 10. If filesize hasn't changed,
      check 3 more times, then say done?
       
    Cheers !

    /Os

    -----Original Message-----
    From: Osama Ahmed [mailto:osama@myrealbox.com]
    Sent: Friday, August 15, 2003 4:55 AM
    To: sunmanagers@sunmanagers.org
    Subject: Knowing EOT or EOF from a shell script

    Hi Gurus,
    This might be slightly off topic but I really need your help.

    I have a group of binary files with a big variable file size
    being transferred to a shared location(Solaris Machine).
    The transfer is done first by allocating a file name and then
    feed the bytes into it.

    i.e:
    ls -l
    -rwxr-xr-x 1 root adm 166132 Aug 10 2003 FEED1

    After 3 sec
    ls -l
    -rwxr-xr-x 1 root adm 168180 Aug 10 2003 FEED1

    And so on.

    My duty is to know(through a Shell script) when each file fully
    and completely transferred to the shared location then transfer
    it to my V880 server. ( I did not know the original size of the
    file or its checksum !)

    My questions:
      - Is there a way to know that the file is completely
    transferred ? (like checking for an EOF byte in the binary
    file-- I tried strings but no luck! )

      - Is there a command to know that the file is closed ?

    Thanks and appreciate the help.

    IWS

    /Os
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: accy guy: "shell question"