inotifywait -m -e close --format %f

gene heskett gheskett at wdtv.com
Tue Jan 18 19:23:23 GMT 2011


On Tuesday, January 18, 2011 01:06:45 pm Kevin Krammer did opine:

> Hi Gene,
> 
> On Tuesday, 2011-01-18, gene heskett wrote:
> > On Tuesday, January 18, 2011 06:24:28 am Kevin Krammer did opine:
> > > On Monday, 2011-01-17, gene heskett wrote:
> > > > Greetings;
> > > > 
> > > > Is there a way I can mate an output from the above command line,
> > > > watching /var/spool/mail, to trigger a 'check mail' function in
> > > > the recent kmail?
> > > > 
> > > > This is a case of not needing the text output, but just the
> > > > occurrence of the output, used as an interrupt to kmail.  This
> > > > would synchronize kmail with the activities of fetchmail and
> > > > procmail/SA so I see incoming mail several minutes quicker.
> > > 
> > > You could execute the checkMail action (check all accounts for new
> > > mail) via D-Bus:
> > > 
> > > qdbus org.kde.kmail /KMail org.kde.kmail.kmail.checkMail
> > 
> > Thank you very much, Kevin.
> > 
> > I grepped the dbus tree in /etc w/o finding such a qdbus example, but
> > found that it has the desired effect when issued from a terminal
> > shell.
> 
> D-Bus interfaces or rather their descriptions don't have to be
> installed, they can be queried at runtime.
> A GUI tool to do that is qdbusviewer, but qdbus can also do this:
> - when invoked wihout any parameter, it will list all D-Bus "names" (one
> process can have several names).
> - when invoked with such a name it will list all objects in this
> process. - when invoked with name and object path, it will list the
> available methods on said object.
> 
> > I have a special mail spool for a niece whose emails, while personal
> > family stuff, look a lot like spam to SA, so I have a procmail rule
> > that bypasses SA.
> > 
> > I put this in ~/gene/bin/watchmail
> > 
> > Is there a way I can put this in the kmail startup so it runs as soon
> > as I run kmail?
> 
> One way would be to have a "kmail" script in your path before the kmail
> binary and let it start the watchmail and then the actual kmail by full
> path.
> 
That sounds doable, and I may try it.  However, since it is not a 
showstopper if mailwatcher is not running, I may just let the present hand 
launched method work.

> Another option would be to take the KMail.desktop file (which is used by
> the laucher menu, etc), copy it to the respective user local path (see
> kde4-config --path xdgdata-apps) and modify it so its "Exec" line runs
> this wrapper script.

That file should already exist in my user/Desktop tree, shouldn't it? Humm, 
no it's not there, nor does there appear to even be a .kde in ~/user?  
FWIW, this is pclos, 32 bit install running on a quad core phenom.  So yet 
another diff I just found.

> Renaming the kmail binary and putting a wrapper script in its place
> would work for as well for a short time, but it would be overwritten
> the next time you update the kmail package.

Ugly, would not consider it.
 
> Cheers,
> Kevin

I have not attempted to do this as yet, not knowing how qdbus would react 
if kmail was not running.  I was considering just putting its invocation 
into the bottom of my rc.local as I know how to do that, and already have 
several such items fired off that way now. That has been done nbow, but 
I've not rebooted.

However, I did discover one gotcha with my script.  inotifywait, even with 
the -q option, still emits some sort of an invisible character at startup 
the trashes the text color and prompt settings of the bash shell (xterm) it 
was launched from. Apparently issued to stdout or stderr, so the invocation 
needs to look like this for that script:

#>./mailwatcher 2>&1 >/dev/null &

and now that shell remains further usable.

The symptoms of the malfunction this creates are that you can do an 'ls' on 
a directory ok, but add the '-l' to it and there is then no apparent 
response to the return key until you hit it a second time, at which point 
you will get 2 prompts displayed, below the one that issued the original 
command by the length of the listing the ls -l asked for.  If you pulldown 
the config menu, click on the appearance tab and scroll the mouse pointer 
over the choices, the missing text shows up as it applies the rules for 
that color schema.

Weird as heck, but the re-direction of the scripts output to >/dev/null 
seems to fix it.

I am also considering adding a 5 second wait, as the kmail mail .wav player 
is distracting when it strums the guitar for every incoming message. 

Thanks Kevin.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Ambition is a poor excuse for not having sense enough to be lazy.
		-- Charlie McCarthy
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list