On Wed, Oct 11, 2000 at 08:19:24PM +0300, Mikko Hänninen wrote:
> the/eXtreme <[EMAIL PROTECTED]> wrote on Wed, 11 Oct 2000:
> > I could use a shell script to `ps' for existing
> > mutt sessions before launching another session;
> > or is there a better way?
> 
> How about a shell script that looks (vaguely) like this:
> 
> #!/bin/sh
> LOCKFILE=~/.mutt.lock
> if [ -f $LOCKFILE ]; then
>   echo "Another Mutt session is already running ($LOCKFILE exists)"
>   exit 1
> else
>   touch $LOCKFILE
>   mutt $*
>   rm $LOCKFILE
> fi
> 
> 
> ... That's untested, I just typed it in, but hopefully it will work.
> At the very least, with minor tweaking.

This is the ps solution that I use all the time. I and Rob Reid
developed this some time ago. I call the mutt exectuable realmutt, this
script muttwrap and alias 'mutt' to 'muttwrap -y'.

I know you can open several mutts and write in all of them, but I prefer
to open the 2nd in readonly to remind me that I really did not want to
do it in most cases and if I did it could be in readonly mode.
 
#!/usr/bin/sh
if ps -U $LOGNAME | grep realmutt > /dev/null 
then
        echo Warning: You are already running Mutt.
        echo Starting mutt in readonly mode.
        sleep 2         # Or however many seconds you need to read the
                        # message before mutt starts.
        /usr/local/bin/realmutt -R $*
else
        echo Starting Mutt OK
        sleep 2
        /usr/local/bin/realmutt $*
fi

Cheers, Brian.

> 
> Hope this helps,
> Mikko
> -- 
> // Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
> // The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
> // Interests: roleplaying, Linux, the Net, fantasy & scifi, the Corrs /
>                                     Meep!

-- 
Associate Professor Brian Salter-Duke (Brian Duke) [EMAIL PROTECTED]  
      School of Biological, Environmental and Chemical Sciences, SITE,
Northern Territory University, Darwin, NT 0909, Australia.  Phone 08-89466702. 
Fax 08-89466847          http://www.smps.ntu.edu.au/school/compchem.html

Reply via email to