Chapter 2. Misc programs

Table of Contents

Mozilla Thunderbird
Current song in mail signature
Broadcasting the song information with icecast

Here are some tips and settings I use to integrate programs into each other.

Mozilla Thunderbird

My favourite email program.

When I call thunderbird while there is an open instance, a new instance is started and the "select profile" dialog is shown. I don't like this behaviour, and so here is a script which just activates a running instance if there is one.

Example 2.1. /home/cweiske/scripts/start-tb

sudo /scripts/mail-popfile

if [ `ps -u cweiske | grep thunderbird-bin | wc -l` -eq 0 ]; then
        #echo "start thunderbird new"
        /usr/bin/thunderbird &
        #echo "thunderbird is running, just activating"
        thunderbird -remote "xfeDoCommand(openInbox)"

The mail-popfile scripts takes care that stunnel (ssh program) and popfile (spam filter) is started, so that I can filter my mails with popfile and use a SSL connection to the mail server at the same time.


This script has to be run as root, so use sudo from your normal profile

Example 2.2. /scripts/mail-popfile


#stunnel - already running?
numstunnel=`ps uax | grep stunnel | wc -l`
if [ $numstunnel -ge 2 ]; then
        echo "stunnel is running"
        echo "starting stunnel"

numpopfile=`ps uax | grep popfile | grep perl | wc -l`
if [ $numpopfile -ge 1 ]; then
        echo "popfile is running"
        echo "starting popfile"
        cd /usr/share/popfile
        ./ &

echo "mail-popfile done"

Normally firefox is started when there is a link in an email in thunderbird, but I am addicted to Opera... So I changed the http protocol handler that it starts Opera now

Example 2.3. /home/cweiske/.thunderbird/default/9sm8x38r.slt/prefs.js

user_pref("", "/home/cweiske/scripts/browser");

with the browser script being the following

Example 2.4. /home/cweiske/scripts/browser

# opens opera with the given url

if [ "x$url" = "x" ]; then

exec opera -newpage "$url"

Now it is comfortable with thunderbird, but I am still missing some things:

  • Tell me the number of newly arrived, non-spam mails