Re: Problem with incron and unzip

From: Samat K Jain <lists_at_samat.org>
Date: Wed, 21 Jan 2009 19:41:26 -0500

On Wednesday 21 January 2009 4:01:02 am Kumer, Franjo wrote:
> In composing my mail I appended wrong zip file. Perhaps this one is
> better.

I still receive a CRC error on the attached file:

$ unzip -t ins-0534-2008_test.zip
Archive: ins-0534-2008_test.zip
error [ins-0534-2008_test.zip]: missing 1 bytes in zipfile
  (attempting to process anyway)
error [ins-0534-2008_test.zip]: attempt to seek before beginning of zipfile
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)
  (attempting to re-compensate)
    testing: pozeni.sql OK
    testing: xxxxxxxr.rep OK
    testing: xxxxxxxr.fmb OK
    testing: RZP_IZRACUN_PZZ.pks OK
    testing: RZP_IZRACUN_PZZ.pkb OK
    testing: naslov.txt bad CRC 691786f0 (should be ade8a8dd)
file #7: bad zipfile offset (local header sig): 110845
  (attempting to re-compensate)
    testing: MG_NS-0544-2008.lst OK
At least one error was detected in ins-0534-2008_test.zip.

This may be an artifact of using Outlook/renaming the file to .txt...

> I send you my writings because I can run call1.sh skript manually or by
> cron and it works fine. If called by incron it does not work.

Hrm... when run via your shell, is it calling the same unzip program that incron is calling?

>
> I made simpler test :
>
> 1. install incron
> 2. start incrond
> 3.create directory Download in working directory (in my case
> /INIS_Popravki/TEST)
> 4.edit incrontab (I used file incron.in2test)
> 5. write script call2.sh
> 6. create temp.zip file (no matter what is in that archive)
> 7. copy temp.zip do Download
> 8. incrond fires and moves temp.zip archive to working directory when
> tries to unzip file unzip.log is written
> 9. unzip.log shows the error - End-of-central-directory....
> manual control
> 10 kill incrond process
> 11 copy test.zip into Download
> 12 run ./call2.sh in terminal
> 13 temp.zip archive is moved to working directory
> 14 temp.zip archive is expanded - no unzip.log

One thing I noticed---are you sure you want incron to use the IN_CREATE event? incron may be calling your scripts before the file has finished writing (hence the incomplete zip file error).

Try IN_CLOSE_WRITE. This event will cause incron to act only when a file being watched has finished writing.

-- 
Samat Jain <http://samat.org/> | GPG: 0x1A1993D3
Partner, Chief Technology Officer | Rhombic Networks, LLC
I don't know with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
-- Albert Einstein (267)
Received on Thu Jan 22 2009 - 01:42:22 CET

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 22:14:21 CEST