LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is there a way to have mutt keep your emails in memory... (http://www.linuxquestions.org/questions/linux-software-2/is-there-a-way-to-have-mutt-keep-your-emails-in-memory-4175446758/)

trist007 01-22-2013 10:16 AM

Is there a way to have mutt keep your emails in memory...
 
I leave my computer on all the time. I notice if I haven't run mutt in a day or so it loads up all the emails in my mailbox when I fire up mutt. Yet if I close mutt and execute mutt again it already has those emails loaded up in memory. Is there a way to keep those emails in memory so that I don't have to wait for mutt to load up all 1000 emails if I haven't run mutt for a few days?

-Tristan

273 01-22-2013 10:26 AM

You could leave mutt running all the time, I can't see it being much of a CPU hog as long as your machine isn't ancient.

trist007 01-22-2013 02:34 PM

Yea I could do that but I just wanted to see if there was another solution.

-Tristan

273 01-22-2013 02:42 PM

Since it's mutt loading them into memory it's mutt's memory that they're been loaded into. Once you close mutt you effectively wipe the memory.
If you have a fair bit of RAM you could copy your mail folder to a RAM disk and open it with mutt?
Otherwise, unless somebody knows something really tricky, I think it would mean rewriting mutt and/or the kernel.

fakie_flip 01-22-2013 03:58 PM

Anything you put under /dev/shm should get stored in ram. For me, tmpfs is mounted at /run. Anything put there also gets stored in ram but is limited to using a certain percentage of the total ram.

trist007 01-24-2013 11:25 AM

So if I wanted to mount my Maildir to ram I could do
Code:

mkfs -q /dev/ram1 1000000000
mkdir ~/storage
mv ~/Maildir ~/storage
mkdir ~/Maildir
mount /dev/ram1 ~/Maildir
cp -rp ~/storage/Maildir/* ~/Maildir

Then of course before I poweroff my computer, which I never do, I copy the Maildir contents back to disk since RAM is volatile memory and erases without power. Or perhaps I could set a cron job to do it once an hour in case of a power outage. That sound about right?

-Tristan

273 01-24-2013 12:55 PM

That's the kind of thing I was thinking of, yes. If you're using IMAP and you leave message on the server you could even forget about copying back to disk at all, I suppose?
Otherwise a cron job sounds like a good idea, perhaps using rsync or that could be overkill?

trist007 01-24-2013 03:08 PM

Yea rsync would be a better solution or maybe just lsync it if I wanted to be paranoid. Yea gotta write to disk, otherwise when you reboot you will lose all your mail.

-Tristan

273 01-25-2013 03:11 AM

I feel embarrassed now having not heard of lsync before. I'll have to take a look at that myself for a couple of directories I'd like on multiple drives/machines.


All times are GMT -5. The time now is 06:12 PM.