On the "Create":  this convinces me that I should take up drinking coffee,
so some stronger brain stimulant. Dumb.

On the multiple entries, I think the issue is that my test script is very
short and fast.  I added a sleep 10 and I get only one entry--the first
one.  Apparently the print driver (or the program calling it) closes the
file multiple times.  I added $% to the incrontab file and %2 to the script
(but w/o the sleep in my script) I got:

test1 create  test23 IN_CLOSE_WRITE
test1 create  test23.PLT IN_CLOSE_WRITE
test1 create  test23.PLT IN_CLOSE_WRITE
test1 create  test23.PLT IN_CLOSE_WRITE

This behavior of the driver/application seems not the best, but there is
nothing to be done about it.  I assume that my printing script will take
sufficient time it will not matter.

I recorded the times associated with the four log entries.  It was 347 msec
overall, with the last step taking most of this time at about 300 msec.  So
my anticipation that the multiple writes/closing will not matter seems
reasonable.  Let's hope so.

Thanks again for the suggestion.

-Denis

On Fri, Nov 17, 2017 at 2:02 PM, Tomas Kuchta <tomas.kuchta.li...@gmail.com>
wrote:

> If I recall incron details correctly, you get multiple entries in your log
> because you run your script multiple times at different events:
> IN_CLOSE_WRITE,IN_NO_LOOP
>
> Your other question: You see "create" in your log because that is what your
> echo command puts there in your script.
>
> -Tomas
>
> On Nov 17, 2017 11:47 AM, "Denis Heidtmann" <denis.heidtm...@gmail.com>
> wrote:
>
> I have pursued Tomas' advice to use incron to automatically send files
> written by the win2k print driver to the printer.  I have everything down
> to one issue.  To test, I have a simple script (intest.sh) that just sends
> the event responded to to a log file:
>
> #! /bin/bash
> # test of incron
> echo "tes1 create " $1 >> /home/denis/incronlog.log
>
> The incron table is:
>
> /home/denis/win2kfiles/Print_files IN_CLOSE_WRITE,IN_NO_LOOP
> /home/denis/scripts/intest.sh $#
>
> The resulting log is:
>
> tes1 create  test12
> tes1 create  test12.PLT
> tes1 create  test12.PLT
> tes1 create  test12.PLT
>
> It generates multiple entries for one file added (i.e., one print
> command).  I added  IN_ONESHOT to the incrontab:
>
> /home/denis/win2kfiles/Print_files IN_CLOSE_WRITE,IN_ONESHOT,IN_NO_LOOP
> /home/denis/scripts/intest.sh $#
>
> I still got multiple entries in the log.
>
>
> Questions:
> Why does the log not say "close" instead of "create"?
> Why four entries?
> What might the result be when the script intest.sh is replaced by one that
> prints and deletes the files?  Will it be called 4 times in rapid
> succession?
>
> Any suggestions for testing further?
>
> Thanks,
> -Denis
> _______________________________________________
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
> _______________________________________________
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to