Re: too many mutts
On 2008-02-04 22:52:02 +, Steve Kemp wrote: Close but not as good as you could do - your script essentially says If mutt is running exit. A better approach would be to use GNU Screen to allow the user to re-attach to a running mutt: alias mutt='screen -D -R -S mutt mutt' This means create a secreen session with name mutt (-S) running wth command mutt - if one is already running with that name detach it first. This is more or less what I do, but this is a bit more complex since it has to handle the current display (as I also use Mutt via SSH). See http://www.vinc17.org/mutt/#smutt. The only drawback is this will get fiddly if you're running nested screen sessions... I think that my smutt script handles that in some way: [...] if [ $TERM = screen-bce ]; then exec screen -t mutt $0 -- [EMAIL PROTECTED]$@} [...] -- Vincent Lefèvre [EMAIL PROTECTED] - Web: http://www.vinc17.org/ 100% accessible validated (X)HTML - Blog: http://www.vinc17.org/blog/ Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
too many mutts
Hello, I am on Etch and using fluxbox mainly to manage windows. I use mutt for email. I start it with a key command. When I get many x-sessions and programs running at once, often mutt is running somewhere and I don't know it, so I do the mutt key command and start a 2nd mutt, then sometimes a third. Is there a script I could make that I could use to start mutt, and if mutt were already running, then it could just take me to the already- running instance of it, instead of starting a new mutt? Thanks for any help. I know some Python if it could be done in there. But I suspect I need a bash script? I didn't see a mutt option that would accomplish this. Thank you for any help. RD -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/04/08 14:36, BartlebyScrivener wrote: Hello, I am on Etch and using fluxbox mainly to manage windows. I use mutt for email. I start it with a key command. When I get many x-sessions and programs running at once, often mutt is running somewhere and I don't know it, so I do the mutt key command and start a 2nd mutt, then sometimes a third. Is there a script I could make that I could use to start mutt, and if mutt were already running, then it could just take me to the already- running instance of it, instead of starting a new mutt? Thanks for any help. I know some Python if it could be done in there. But I suspect I need a bash script? I didn't see a mutt option that would accomplish this. Thank you for any help. I think I'd write a bash script to grep thru ps(1) and refuse to start a new instance if a mutt instance is already running. - -- Ron Johnson, Jr. Jefferson LA USA PETA - People Eating Tasty Animals -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHp4XZS9HxQb37XmcRAmYiAKCYwtyEtXVEqQIdvnb2dFVvaAPuCQCeLMIV K4OHiexEKJMOV9rmDHA0P3k= =vyVz -END PGP SIGNATURE- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
On Mon, 04 Feb 2008 22:00:19 +0100, BartlebyScrivener wrote: Is there a script I could make that I could use to start mutt, and if mutt were already running, then it could just take me to the already- running instance of it, instead of starting a new mutt? Hacked up from a little perlish I had hanging around my @running `/bin/ps -aefw |/bin/grep 'perl' |/bin/grep 'mutt'|/bin/grep -v 'grep'`; if (scalar @running 1) { die mutt already running\n; } else { system(mutt); } -- Stephen Patterson :: [EMAIL PROTECTED] :: http://patter.mine.nu/ GPG: B416F0DE :: Jabber: [EMAIL PROTECTED] Don't be silly, Minnie. Who'd be walking round these cliffs with a gas oven? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
On Mon Feb 04, 2008 at 21:50:33 +, Patter wrote: On Mon, 04 Feb 2008 22:00:19 +0100, BartlebyScrivener wrote: Is there a script I could make that I could use to start mutt, and if mutt were already running, then it could just take me to the already- running instance of it, instead of starting a new mutt? Hacked up from a little perlish I had hanging around Close but not as good as you could do - your script essentially says If mutt is running exit. A better approach would be to use GNU Screen to allow the user to re-attach to a running mutt: alias mutt='screen -D -R -S mutt mutt' This means create a secreen session with name mutt (-S) running wth command mutt - if one is already running with that name detach it first. The only drawback is this will get fiddly if you're running nested screen sessions... Steve -- Debian GNU/Linux System Administration http://www.debian-administration.org/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
On Feb 4, 3:50 pm, Ron Johnson [EMAIL PROTECTED] wrote: I think I'd write a bash script to grep thru ps(1) and refuse to start a new instance if a mutt instance is already running. Ok, I have that part. But is there a way to bring the already running mutt process to the fore instead of just saying, Mutt is already running? Thanks #!/bin/bash SERVICE='Mutt' if ps ax | grep -i $SERVICE /dev/null then echo $SERVICE is already running!!! else gnome-terminal --window-with-profile=muttprofile --geometry=80x47 - x mutt fi -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
On Feb 4, 5:10 pm, Steve Lamb [EMAIL PROTECTED] wrote: Maybe a change in work habits would be more appropriate? I got into the habit ages ago of using multiple desktops and throwing specific tasks on certain desktops. Great suggestion. I don't use desktops enough. Thanks for all of the quick advice. RD -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
On Feb 4, 5:00 pm, Steve Kemp [EMAIL PROTECTED] wrote: alias mutt='screen -D -R -S mutt mutt' The only drawback is this will get fiddly if you're running nested screen sessions... Hey, Steve, this works great. Thanks. And I'm not smart enough to run a nested screen session, so I bet I'm safe. :) Thanks, RD http://dooling.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
BartlebyScrivener wrote: Is there a script I could make that I could use to start mutt, and if mutt were already running, then it could just take me to the already- running instance of it, instead of starting a new mutt? I know some Python if it could be done in there. But I suspect I need a bash script? Chances are bash would be the last thing you want to use for something like this. Often times WMs and DEs will have bindings for Perl or Python. I've yet to hear of bindings written for bash. The first part of the problem is easy. You've got the crude method already offered of checking ps but that kind of fails if you're on a multi-user system and someone else is running mutt. A simpler dotlock in ~ would work universally. I know that's not part of your original specification but it is unspecified whether the machine is multiuser so I err on the side of universal solutions in those cases. ;) As for the second issue, bringing the current terminal to the fore, is where the environment specific bindings comes in. I don't know if Fluxbox has such bindings for any scripting language but what you need is for a way for a script to tell the WM to bring a specific window to the top. Barring something like that I doubt there is any really neat way to do it. Maybe a change in work habits would be more appropriate? I got into the habit ages ago of using multiple desktops and throwing specific tasks on certain desktops. Communications, IE, email/im go on desktop 1. If I need to work on those I pop over there where it's always open and always on the top. Browsing is on 4. Productivity (programming, writing, sysadmin) goes on desktop 3. By splitting it up that way I can dedicate the entire screen to a task, organize the screen to fit that task and not worry about opening specific programs from the taskbar. I only need to know where the desktop buttons and those never change position. :) As you can imagine no matter what mail client I use, GUI or CLI, I never opened more than one because it always occupied the same space on desktop 1. -- Steve Lamb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: too many mutts
On Mon, Feb 04, 2008 at 12:36:15PM -0800, BartlebyScrivener wrote: Hello, I am on Etch and using fluxbox mainly to manage windows. I use mutt for email. I start it with a key command. When I get many x-sessions and programs running at once, often mutt is running somewhere and I don't know it, so I do the mutt key command and start a 2nd mutt, then sometimes a third. Is there a script I could make that I could use to start mutt, and if mutt were already running, then it could just take me to the already- running instance of it, instead of starting a new mutt? Thanks for any help. I know some Python if it could be done in there. But I suspect I need a bash script? I use screen screen -DR mutt keeps a sesion open, first time you have to start mutt, but yuo could add something to cron tostart it at boot time ? I didn't see a mutt option that would accomplish this. Thank you for any help. RD -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED] -- See, without the tax relief package, there would have been a deficit, but there wouldn't have been the commiserate -- not commiserate -- the kick to our economy that occurred as a result of the tax relief. - George W. Bush 12/15/2003 Washington, DC signature.asc Description: Digital signature