inotifywait -m -e close --format %f

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


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.

I believe I can carve up a little bash daemon using inotifywait to do that 
however.  I just finished such a beast that prints any file .txt file that 
shows up in the watched directory using it so this shouldn't be quite as 
much code.

Ahh, yes, this seems to work very nicely, and quickly enough that gkrellm 
never starts the you've got mail animation.  So in case someone else finds 
this helpful:
===================================
#!/bin/bash
WatchDir=/var/spool/mail
Cmd="qdbus org.kde.kmail /KMail org.kde.kmail.kmail.checkMail"
while :
do
        InMail=`/usr/bin/inotifywait -q -e close --format %f ${WatchDir}`
        if [[ ${InMail} = 'gene' ]]
        then
                $Cmd
        elif [[ ${InMail} = 'gene-from-linda' ]]
        then
                $Cmd
        fi
        InMail=''
done
===================================
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?

Thanks again.

> There is also a checkAccount action for checking only one account, but I
> didn't have time to look into that yet.
> 
> Cheers,
> 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)
Once is happenstance,
Twice is coincidence,
Three times is enemy action.
		-- Auric Goldfinger
___________________________________________________
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