Mutt Wrapper Script To Detect Already Running Mutts

Brian Salter-Duke improved this to check if another mutt is actually running using ps instead of a lockfile (which would fail if mutt crashed for some reason). Depending on your version of Unix (the script presented here works with Red Hat Linux 5.1), you might need to use "ps -U $LOGNAME | grep realmutt > /dev/null" to get only mutts belonging to you.

Note that a mutt (0.93.2i) started in readonly mode loses its readonly status when it switches to a different mailbox, and does not get it back when it returns to the starting folder.


#!/bin/sh COLORFGBG=default export COLORFGBG # Disable alternate screen so I can read a message while composing. oldterm=$TERM TERM=xterm-xfree86 export TERM if ps | grep realmutt | grep -v grep > /dev/null ; then echo Warning: You are already running Mutt. echo Starting mutt in readonly mode. sleep 1 # Or however many seconds you need to read the # message before mutt starts. exec /usr/local/bin/realmutt -R $* else # echo Starting mutt normally... # sleep 1 /usr/local/bin/realmutt $* fi # Set TERM to whatever it was before mutt started. TERM=$oldterm export TERM
Leash last used: Last modified: Tue Dec 15 18:32:45 EST 1998 .