[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"

    Relevant Pages

    • Re: truncate() file function and EOF problem
      ... Programming by example)and encounter a problem of write EOF to file ... truncate is a POSIX extension to C. ... imlementations can add null padding bytes to binary files. ...
      (comp.lang.c)
    • Re: EOF (novice)
      ... Simple -- escape codes. ... For example, the EOF ... closer to what I think James means by "a compressed filesystem." ... > your scheme simply does not work for binary files. ...
      (comp.lang.c)
    • Re: find out which partiton
      ... > on computers. ... > does anyone know a way to get this info by WSH-Script, shell script or a ... goto:EOF ...
      (microsoft.public.win2000.cmdprompt.admin)
    • Re: Help with binary files, read, and eof
      ... > binary files, but can't seem to find the problem. ... > My problem is with EOF handling. ... > set noquit 1 ... > flush $fh ...
      (comp.lang.tcl)
    • Re: Remote Shell Variable
      ... > I have been trying to write a shell script which is like this: ... sqlplus user/pw <<EOF ... First single quotes, then escaped double quotes to enclose the commands ... Stein Arne ...
      (comp.unix.shell)