Re: 4.6.2 early report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, April 11, 2011 07:45:35 AM Duncan did opine:

> gene heskett posted on Mon, 11 Apr 2011 00:00:41 -0400 as excerpted:
> > Chuckle.  There are broadcast related things that I am an expert at,
> > but cobbling up bash scripts is about the limit here on a 64 bit
> > machine.  I usually manage to get the job done, but expert? 
> > Dontbesilly...

Re my script. I didn't use pgrep, but $pidof, and it works, I can start 
and stop kmail and this script follows suit:
===============
#!/bin/bash
# REQUIRES your distros inotify-tools package, assume kde/kmail in use
# but might be adaptable to other agents too
# requires a ~/log directory, so mkdir it before running it
# when launching this, all output MUST be redirected 2>&1 >/dev/null 
# like "/path/to/mailwatcher 2>&1 >/dev/null &"
# As inotifywait is not silent on launch even with the -q option
WatchDir=/var/spool/mail/
# Setup temporary log
Log=mail.log
Mlog=~/log
touch ${Mlog}/${Log}
## and give this an absolute path
# this does not work correctly unless kmail is already
# running so see if its running first before doing the
Inotifywait bit.

Cmd="/usr/lib/qt4/bin/qdbus org.kde.kmail /KMail org.kde.kmail.kmail.checkMail"
while :
do
	if [ $(pidof kmail) ]; then
		# I've found that stderr needs dumped to /dev/null, so
		InMail=`/usr/bin/inotifywait -q -e close --format %f ${WatchDir}` 2>&1 >/dev/null 
		if [[ ${InMail} = 'gene' ]]
		then
			$Cmd
		elif [[ ${InMail} = 'gene-from-linda' ]]
		then
			$Cmd
		elif [[ ${InMail} = 'amanda' ]]
		then
			${Cmd}
		fi
	
		date -R >>${Mlog}/${Log}
		echo ${InMail} >>${Mlog}/${Log}
		InMail=''
	else
		sleep 3
	fi
done
================

Be my guest folks.  This, in combination with fetchmail running as a
daemon, feeding procmail which drives spamassassin, leaves kmail only
needing to pull from /var/spool/mail/$account, doing it on the sent signal.

Making all the mail fetching into a background task that kmail need
not do, makes kmail much more pleasant to use.  No huge it went to
sleeps in the middle of composing a message cause it had other things
to do that are, IMNSHO, a heck of a lot better left to fetchmail etc.
Configure kmail to do a startup checkmail to clear the spool file &
let this script do the rest.  You get your mail milliseconds after its
been deposited in the spool file.  Linux can multi-task folks, use it.

Even a blind man finds an apple occasionally. ;-)

Now tear it up & chew me out, this kmail detection was todays additions,
the rest of it has been running here for about a year.  The diff?

Now I can put it in /etc/rc.d/rc.local & quit running it by hand after
I get kmail started.

-- 
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)
<http://tinyurl.com/ddg5bz>
<http://www.cantrip.org/gatto.html>
1 KAISER ROLL?!  What good is a Kaiser Roll without a little COLE SLAW
on the SIDE?
___________________________________________________
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.


[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux