This script launches
SpamBayes then Thunderbird. Once Thunderbird quits,
SpamBayes is shut down.
#!/bin/bash
# SpamBayes database and configuration files are stored at $SB_HOME
SB_HOME=~/spambayes
[ ! -d $SB_HOME ] && mkdir $SB_HOME
cd $SB_HOME
# Launch the proxy in background
sb_server.py &
# Launch the email client
mozilla-thunderbird
# Shutdown the server (taken from sb_server.py)
python - <<-EOS
from urllib import urlopen, urlencode
urlopen('http://localhost:8880/save',
urlencode({'how': 'Save & shutdown'})).read()
EOS