Coda File System

remote mailchecking via coda

From: Greg Troxel <gdt_at_ir.bbn.com>
Date: Fri, 28 Feb 2003 16:02:43 -0500
I get mail on one machine, and often use a notebook someplace else,
reading mail over ssh.  The spiffy gnome taskbar mailcheck applet on
the notebook doesn't show me the state of my remote inbox.  So I wrote
this script, run once a minute out of cron and on mail delivery via
procmail.

Interesting points are

* avoid writing to coda unless the state would change, so there are no
  gratuitous invalidation callbacks

* pseudo-mailbox checked by notebook is in a directory by itself, so I
  don't invalidate my homedir, which would take longer to fetch

Watching codacon, I see the callback when mail arrives, and a GetAttrs
of Mailbox shortly after.  The stat every 10s from the mailcheck
applet normally doesn't cause network traffic.

This is kind of hackish, but it was easier than writing a remote
mailcheck and less scary than turning on imap/pop3 for my workstation.


#!/bin/sh

MAILBOX=$HOME/Mailbox
# don't write main dir - invalidate something small
CODABOX=/coda/home/gdt/Mail/Mailbox

PATH=/usr/local/coda/bin:$PATH

if ctokens | egrep Expiration 2>&1 > /dev/null; then
  if [ -s $HOME/Mailbox ]; then
    if [ -s $CODABOX ]; then
       true;
    else
       date > $CODABOX
    fi
  else
    if [ -s $CODABOX ]; then
      cp /dev/null $CODABOX
    else
      true;
    fi
  fi
fi
Received on 2003-02-28 16:34:40