Michael> I didn't figure out how to tell it to index all the folders in
Michael> ~/Mail. Maybe "mh=..." would work, not sure.
I wrote a nightly (ana)cron job to do that (attached). It looks for any
MMDF files on my machine, and also adds all directories in my MH tree
(except "s", which is where I put search results). Might be overkill,
but could give some ideas.
As is, if the cron script is installed in
/some/path/lib/update_mairix_rc_and_db
.. it'll expect another file called /some/path/etc/mairix-do_not_index
which lists any MMDF files I don't want indexed.
I've also aliased 'mx' to
'mairix \!* && scan +s'
.. can't think of any situation where I wouldn't want to see the search
results immediately.
Conrad
#!/bin/sh -e
# Update my mairixrc and run mairix.
rc=$HOME/.mairixrc
newrc="$rc.new"
mhpath=`/usr/bin/mh/mhpath +`
self=$(readlink -f "$0")
mydir=$(dirname "$self")
cd $mhpath
folders=`find * -type d | grep -v '^s$' | sort | tr '\012' : | \
sed 's/:$//'`
cat > "$newrc" <<EOF
# DO NOT EDIT!!
#
# Machine generated by
# $self
base=$mhpath
mh=$folders
mfolder=s
mformat=mh
database=$HOME/.shared/var/lib/mairix/mail_index.db
sort=date+
EOF
filter="$mydir/../etc/mairix-do_not_index"
locate .mmdf | egrep '\.mmdf(|\.bz2|\.gz|\.xz)$' | \
if [ -f "$filter" ]
then
grep --invert-match --file="$filter" | sort
else
sort
fi | sed 's/^/mbox=/' >> "$newrc"
if [ -f "$rc" ]
then
if cmp --silent "$rc" "$newrc"
then
rm "$newrc"
else
echo 'mairix configuration has changed!'
diff "$rc" "$newrc" || true
mv "$newrc" "$rc"
fi
else
mv "$newrc" "$rc"
fi
mairix --purge