syncing mail and address book
tony at baechler.net
Sun Mar 30 10:14:36 UTC 2008
Daniel Dalton wrote:
>> The rsync (1) program is your friend. It's ideal for just such a
>> purpose. Do something like this, replacing the ip addresses and/or
>> hostnames with the right ones:
>> rsync . 192.168.0.2:. for current directory, replace with ~ for home dir
> Thanks, I think that's what I want. Otherwise I'll try some bash with
> diff and patch...
> Also how would I sync between /var/mail/d.dalton to /media/usb1?
If the /media/usb1 dir is on your local machine, just do:
rsync /var/mail/whatever /media/usb1/.
Again, the final dot is probably not necessary, and in fact you might
need to remove it if you get errors.
> And with syncing the mail directory ~/mail where alpine stores its
> folders will rsync sync all the text files? Or just add newly added
> files and remove files?
> And rsync won't remove mail will it? Say if a message exists on
> desktop, but not on laptop will it be removed?
rsync is a very powerful program. In short, it will only do what you
tell it. If you give it the delete flag, it will delete. Otherwise, it
mirrors the dirs exactly so that both copies are identical. You really
need to read the rsync (1) man page and try some examples. It's really
simple to learn the basic usage. I suggest the -av switches at first so
you can see exactly what it's doing and to preserve dates, times and
permissions. I would make a /tmp/mail dir and copy all your mail there.
Practice with rsync copying it back and forth to another temp directory.
Delete just a single message and/or add new messages. rsync will work
perfectly every time.
As another example, I have several hundred mailboxes of saved messages,
all with about 1,000 messages each. Again, rsync saves the day for me by
mirroring the files from my home dir on a remote system to my local
machine. If I log into the remote server with ssh and read some mail
from a saved mailbox and later delete that mail, rsync deletes the mail
on the local mirror as well. If I add a new mailbox, it also will copy
the new mailbox. It's really very, very convenient.
Tim Chase also makes a point, although I personally don't agree with his
method having used rcs before. If you're worried about losing mail or if
you want undelete ability, use a version control system. Debian has the
rcs package which is what I would suggest. You have to check out your
mail folders every time and check them back in when you're done reading
email. To me, that seems like a big pain and still won't mirror your
mail to and from your laptop. With rsync, you could set up a cron job if
you want and never worry about it again. Seriously, rsync is an amazing
program! Here's one more example of how I mirror my hundreds of
mailboxes containing saved messages of rss feeds from rss2email to my
rsync -av tony at example.com:~/rss/. g:\serverhome\rss
Notice the backslashes in the second path. That's because I'm copying
from Linux to Windows. It's nice having your email available in Windows,
especially if you use Eudora or Thunderbird which handles the mbox
More information about the Blinux-list