Kmail backup question - KDE

This is a discussion on Kmail backup question - KDE ; I'd like to know if there is a way to make a 'selective' backup in Kmail. Explanation: I have way too many e-mails in my kmail client. I'd like to backup the older ones, and keep only the most recent ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Kmail backup question

  1. Kmail backup question

    I'd like to know if there is a way to make a 'selective' backup in Kmail.
    Explanation: I have way too many e-mails in my kmail client. I'd like to
    backup the older ones, and keep only the most recent ones active in kmail.
    Concretely, my mails are divided in folders. Last year mails are in a folder
    called '2004', which contains some subfolders for In and Out. And the same
    for the previous years.
    I'd like to be able to archive, for example, 2004, 2003, and so on, and
    being able to put them back, in case I need to.
    If it is possible, what files should I backup and which not?
    My mailbox files are in 'maildir' format.

  2. Re: Kmail backup question

    Marco B. wrote:

    > I'd like to know if there is a way to make a 'selective' backup in Kmail.
    > Explanation: I have way too many e-mails in my kmail client. I'd like to
    > backup the older ones, and keep only the most recent ones active in kmail.
    > Concretely, my mails are divided in folders. Last year mails are in a
    > folder called '2004', which contains some subfolders for In and Out. And
    > the same for the previous years.
    > I'd like to be able to archive, for example, 2004, 2003, and so on, and
    > being able to put them back, in case I need to.
    > If it is possible, what files should I backup and which not?
    > My mailbox files are in 'maildir' format.


    You can probably graft entire directories under ~/Mail and put them at a
    separate location for backup. You can set up a cron job that does this
    occasionally and possibly backs up the relevant files. Simply by
    coincidence, I wrote about this method earlier this morning:

    http://schestowitz.com/Weblog

    Roy

  3. Re: Kmail backup question

    Roy Schestowitz wrote:

    > Marco B. wrote:
    >
    >> I'd like to know if there is a way to make a 'selective' backup in Kmail.
    >> Explanation: I have way too many e-mails in my kmail client. I'd like to
    >> backup the older ones, and keep only the most recent ones active in
    >> kmail. Concretely, my mails are divided in folders. Last year mails are
    >> in a folder called '2004', which contains some subfolders for In and Out.
    >> And the same for the previous years.
    >> I'd like to be able to archive, for example, 2004, 2003, and so on, and
    >> being able to put them back, in case I need to.
    >> If it is possible, what files should I backup and which not?
    >> My mailbox files are in 'maildir' format.

    >
    > You can probably graft entire directories under ~/Mail and put them at a
    > separate location for backup. You can set up a cron job that does this
    > occasionally and possibly backs up the relevant files. Simply by
    > coincidence, I wrote about this method earlier this morning:
    >
    > http://schestowitz.com/Weblog
    >
    > Roy

    That is what I do. Although, I just manually move the email files to a
    backup directory. Starting Kmail the next time clears the list and by
    moving them back to the Kmail location, the emails are restored and
    readable.

  4. Re: Kmail backup question

    Terry wrote:

    > Roy Schestowitz wrote:
    >
    >> Marco B. wrote:
    >>
    >>> I'd like to know if there is a way to make a 'selective' backup in
    >>> Kmail. Explanation: I have way too many e-mails in my kmail client. I'd
    >>> like to backup the older ones, and keep only the most recent ones active
    >>> in kmail. Concretely, my mails are divided in folders. Last year mails
    >>> are in a folder called '2004', which contains some subfolders for In and
    >>> Out. And the same for the previous years.
    >>> I'd like to be able to archive, for example, 2004, 2003, and so on, and
    >>> being able to put them back, in case I need to.
    >>> If it is possible, what files should I backup and which not?
    >>> My mailbox files are in 'maildir' format.

    >>
    >> You can probably graft entire directories under ~/Mail and put them at a
    >> separate location for backup. You can set up a cron job that does this
    >> occasionally and possibly backs up the relevant files. Simply by
    >> coincidence, I wrote about this method earlier this morning:
    >>
    >> http://schestowitz.com/Weblog
    >>
    >> Roy

    > That is what I do. Although, I just manually move the email files to a
    > backup directory. Starting Kmail the next time clears the list and by
    > moving them back to the Kmail location, the emails are restored and
    > readable.


    #!/bin/bash

    echo
    echo "Backup script voor mail"
    # Create a compressed backup of your home directory in a file named
    # backup.tar.gz or backup.tar.bz2 depending on the compression scheme used.


    BACKUP_DIRS=/media/backup/mail
    BACKUP_FILE=/home/lucdc/.kde/share/config/kmailrc
    BACKUP_BOOK=/home/lucdc/.kde/share/apps/konqueror/bookmarks.xml

    rm /media/backup/mailbackup/mail.tar.gz
    rm /media/backup/mailbackup/kmailrc.tar.gz
    rm /media/backup/mailbackup/bookmark.tar.gz
    echo
    echo
    echo
    echo "Vorige files verwijderd"
    echo
    echo
    echo

    # Uncomment the following line if you want GZipped backups

    tar -cvzf /media/backup/mailbackup/mail.tar.gz $BACKUP_DIRS
    tar -cvzf /media/backup/mailbackup/kmailrc.tar.gz $BACKUP_FILE
    tar -cvzf /media/backup/mailbackup/bookmark.tar.gz $BACKUP_BOOK


    echo "De backup file is aangemaakt"
    echo "Groeten VenimK"

  5. Re: Kmail backup question

    Terry wrote:

    > Roy Schestowitz wrote:
    >
    >> Marco B. wrote:
    >>
    >>> I'd like to know if there is a way to make a 'selective' backup in
    >>> Kmail. Explanation: I have way too many e-mails in my kmail client. I'd
    >>> like to backup the older ones, and keep only the most recent ones active
    >>> in kmail. Concretely, my mails are divided in folders. Last year mails
    >>> are in a folder called '2004', which contains some subfolders for In and
    >>> Out. And the same for the previous years.
    >>> I'd like to be able to archive, for example, 2004, 2003, and so on, and
    >>> being able to put them back, in case I need to.
    >>> If it is possible, what files should I backup and which not?
    >>> My mailbox files are in 'maildir' format.

    >>
    >> You can probably graft entire directories under ~/Mail and put them at a
    >> separate location for backup. You can set up a cron job that does this
    >> occasionally and possibly backs up the relevant files. Simply by
    >> coincidence, I wrote about this method earlier this morning:
    >>
    >> http://schestowitz.com/Weblog
    >>
    >> Roy

    > That is what I do. Although, I just manually move the email files to a
    > backup directory. Starting Kmail the next time clears the list and by
    > moving them back to the Kmail location, the emails are restored and
    > readable.


    #!/bin/bash

    echo
    echo "Backup script voor mail"
    # Create a compressed backup of your home directory in a file named
    # backup.tar.gz or backup.tar.bz2 depending on the compression scheme used.


    BACKUP_DIRS=/media/backup/mail
    BACKUP_FILE=/your/homedir/.kde/share/config/kmailrc
    BACKUP_BOOK=/your/homedir/.kde/share/apps/konqueror/bookmarks.xml

    rm /media/backup/mailbackup/mail.tar.gz
    rm /media/backup/mailbackup/kmailrc.tar.gz
    rm /media/backup/mailbackup/bookmark.tar.gz
    echo
    echo
    echo
    echo "Vorige files verwijderd"
    echo "Previous backup removed"
    echo
    echo

    # Uncomment the following line if you want GZipped backups

    tar -cvzf /media/backup/mailbackup/mail.tar.gz $BACKUP_DIRS
    tar -cvzf /media/backup/mailbackup/kmailrc.tar.gz $BACKUP_FILE
    tar -cvzf /media/backup/mailbackup/bookmark.tar.gz $BACKUP_BOOK


    echo "De backup file is aangemaakt"
    echo "Groeten VenimK"


    put this in cron to run daily or so

  6. Re: Kmail backup question

    VenimK wrote:

    > Terry wrote:
    >
    >> Roy Schestowitz wrote:
    >>
    >>> Marco B. wrote:
    >>>
    >>>> I'd like to know if there is a way to make a 'selective' backup in
    >>>> Kmail. Explanation: I have way too many e-mails in my kmail client. I'd
    >>>> like to backup the older ones, and keep only the most recent ones
    >>>> active in kmail. Concretely, my mails are divided in folders. Last year
    >>>> mails are in a folder called '2004', which contains some subfolders for
    >>>> In and Out. And the same for the previous years.
    >>>> I'd like to be able to archive, for example, 2004, 2003, and so on, and
    >>>> being able to put them back, in case I need to.
    >>>> If it is possible, what files should I backup and which not?
    >>>> My mailbox files are in 'maildir' format.
    >>>
    >>> You can probably graft entire directories under ~/Mail and put them at a
    >>> separate location for backup. You can set up a cron job that does this
    >>> occasionally and possibly backs up the relevant files. Simply by
    >>> coincidence, I wrote about this method earlier this morning:
    >>>
    >>> http://schestowitz.com/Weblog
    >>>
    >>> Roy

    >> That is what I do. Although, I just manually move the email files to a
    >> backup directory. Starting Kmail the next time clears the list and by
    >> moving them back to the Kmail location, the emails are restored and
    >> readable.

    >
    > #!/bin/bash
    >
    > echo
    > echo "Backup script voor mail"
    > # Create a compressed backup of your home directory in a file named
    > # backup.tar.gz or backup.tar.bz2 depending on the compression scheme
    > # used.
    >
    >
    > BACKUP_DIRS=/media/backup/mail
    > BACKUP_FILE=/your/homedir/.kde/share/config/kmailrc
    > BACKUP_BOOK=/your/homedir/.kde/share/apps/konqueror/bookmarks.xml
    >
    > rm /media/backup/mailbackup/mail.tar.gz
    > rm /media/backup/mailbackup/kmailrc.tar.gz
    > rm /media/backup/mailbackup/bookmark.tar.gz
    > echo
    > echo
    > echo
    > echo "Vorige files verwijderd"
    > echo "Previous backup removed"
    > echo
    > echo
    >
    > # Uncomment the following line if you want GZipped backups
    >
    > tar -cvzf /media/backup/mailbackup/mail.tar.gz $BACKUP_DIRS
    > tar -cvzf /media/backup/mailbackup/kmailrc.tar.gz $BACKUP_FILE
    > tar -cvzf /media/backup/mailbackup/bookmark.tar.gz $BACKUP_BOOK
    >
    >
    > echo "De backup file is aangemaakt"
    > echo "Groeten VenimK"
    >
    >
    > put this in cron to run daily or so


    Wow. This is excellent mate. Thanks for that...

    Roy

    --
    Roy Schestowitz
    http://schestowitz.com

  7. Re: Kmail backup question

    Terry wrote:

    > That is what I do. Although, I just manually move the email files to a
    > backup directory. Starting Kmail the next time clears the list and by
    > moving them back to the Kmail location, the emails are restored and
    > readable.


    my ~/Mail directory actually contains a lot of files.

    Does it mean that for every Kmail folder I have to backup and move away:

    1. the files:

    ..*.index
    ..*.index.ids
    ..*.index.sorted

    2. the sub-directories:

    ..*.directory/
    cur/
    new/
    tmp/

    3. the files that these directories might contain, such as:

    1110206917.26627.FIWlA:2,S 1110216106.27085.KXPf8:2,S
    1110473658.3027.fTEdt:2,S
    1110210372.26811.mWl3c:2,S 1110217022.27085.vbG2s:2,S
    1110216052.27085.emfvt:2,S 1110359183.3139.odXwe:2,S


  8. Re: Kmail backup question

    VenimK wrote:

    > put this in cron to run daily or so


    thanks a lot!

  9. Re: Kmail backup question

    I used some of the ideas in the script to adapt it to my needs, but I am
    inacapable of finishing the script.
    what I would like to do is to run this script so that each phase happens
    only when the previous is finished.
    can somebody help me?


    #!/bin/bash
    echo
    echo "Backup script is starting..."
    echo

    #phase 1

    echo "Backing up Kopete..."
    tar -C /home/user
    -czf /home/user/.backup/kopete.tar.gz .kde/share/apps/kopete .kde/share/config/kopeterc
    echo "....done"
    echo "Backing up KDE window settings..."
    tar -C /home/user
    -czf /home/user/.backup/kwin.tar.gz .kde/share/config/kwinrc
    echo "...done"
    echo "Backing up Knotes..."
    tar -C /home/user
    -czf /home/user/.backup/knotes.tar.gz .kde/share/apps/knotes
    echo "...done"
    echo "Backing up Kwallet..."
    tar -C /home/user
    -czf /home/user/.backup/kwallet.tar.gz .kde/share/apps/kwallet .kde/share/config/kwalletrc
    echo "...done"
    echo "Backing up Konqueror's cookies..."
    tar -C /home/user
    -czf /home/user/.backup/cookies.tar.gz .kde/share/apps/kcookiejar
    echo "...done"
    echo "Backing up Konqueror's bookmarks..."
    tar -C /home/user
    -czf /home/user/.backup/konq.tar.gz .kde/share/apps/konqueror
    echo "...done"
    echo "Backing up the address book..."
    tar -C /home/user
    -czf /home/user/.backup/kab.tar.gz .kde/share/apps/kabc .kde/share/config/kaddressbookrc
    echo "...done"
    echo "Backing up Kmail settings..."
    tar -C /home/user
    -czf /home/user/.backup/kmail.tar.gz .kde/share/apps/kmail .kde/share/config/kmailrc
    echo "...done"
    echo "Backing up Knode settings and messages..."
    tar -C /home/user
    -czf /home/user/.backup/knode.tar.gz .kde/share/apps/knode .kde/share/config/knoderc
    echo "...done"
    echo "Backing up your Skype settings..."
    tar -C /home/user -czf /home/user/.backup/skype.tar.gz .Skype
    echo "...done"
    echo "Backing up all the .kde/share directory..."
    tar -C /home/user -czf /home/user/.backup/kdeconf.share.tar.gz .kde/share
    echo "...done"
    echo "Backing up all the .kde/menus directory..."
    tar -C /home/user -czf /home/user/.backup/kdeconf.menus.tar.gz .kde/menus
    echo "...done"
    echo "Backing up your documents..."
    tar -C /home/user -czf /home/user/.backup/docs.tar.gz Documents
    echo "...done"
    echo "Backing up your mail messages..."
    tar -C /home/user -czf /home/user/.backup/mail.tar.gz Mail
    echo "...done"
    echo
    echo "Backup on hard disk is completed; writing now data to cd"

    #phase 2

    echo
    echo "Creating ISO image of your backup"
    mkisofs -R -ov /tmp/kde-user/bkp.iso /home/user/.backup
    echo
    echo "ISO image created"

    #phase 3

    echo
    echo "blanking cd"
    cdrecord -v dev=0,1,0 speed=2 blank=fast
    echo
    echo "cd blanked"

    #phase 4

    echo
    echo "Writing data to cd"
    cdrecord -v speed=2 dev=0,1,0 -multi -eject /tmp/kde-user/bkp.iso
    echo
    echo "Data written to cd"

    #phase 5

    rm /tmp/kde-user/bkp.iso
    echo "Temporary ISO image removed"

    #phase 6

    rm /home/user/.backup/kopete.tar.gz
    rm /home/user/.backup/kwin.tar.gz
    rm /home/user/.backup/knotes.tar.gz
    rm /home/user/.backup/kwallet.tar.gz
    rm /home/user/.backup/cookies.tar.gz
    rm /home/user/.backup/konq.tar.gz
    rm /home/user/.backup/kab.tar.gz
    rm /home/user/.backup/kmail.tar.gz
    rm /home/user/.backup/knode.tar.gz
    rm /home/user/.backup/skype.tar.gz
    rm /home/user/.backup/kdeconf.share.tar.gz
    rm /home/user/.backup/kdeconf.menus.tar.gz
    rm /home/user/.backup/docs.tar.gz
    rm /home/user/.backup/mail.tar.gz
    echo "Hard disk backup .tar.gz files removed"
    echo
    echo "Backup has been written to cd"

  10. Re: Kmail backup question

    Marco B. wrote:

    > I used some of the ideas in the script to adapt it to my needs, but I am
    > inacapable of finishing the script.
    > what I would like to do is to run this script so that each phase happens
    > only when the previous is finished.
    > can somebody help me?
    >
    >
    > #!/bin/bash
    > echo
    > echo "Backup script is starting..."
    > echo
    >
    > #phase 1
    >
    > echo "Backing up Kopete..."
    > tar -C /home/user
    > -czf /home/user/.backup/kopete.tar.gz .kde/share/apps/kopete
    > .kde/share/config/kopeterc echo "....done"
    > echo "Backing up KDE window settings..."
    > tar -C /home/user
    > -czf /home/user/.backup/kwin.tar.gz .kde/share/config/kwinrc
    > echo "...done"
    > echo "Backing up Knotes..."
    > tar -C /home/user
    > -czf /home/user/.backup/knotes.tar.gz .kde/share/apps/knotes
    > echo "...done"
    > echo "Backing up Kwallet..."
    > tar -C /home/user
    > -czf /home/user/.backup/kwallet.tar.gz .kde/share/apps/kwallet
    > .kde/share/config/kwalletrc echo "...done"
    > echo "Backing up Konqueror's cookies..."
    > tar -C /home/user
    > -czf /home/user/.backup/cookies.tar.gz .kde/share/apps/kcookiejar
    > echo "...done"
    > echo "Backing up Konqueror's bookmarks..."
    > tar -C /home/user
    > -czf /home/user/.backup/konq.tar.gz .kde/share/apps/konqueror
    > echo "...done"
    > echo "Backing up the address book..."
    > tar -C /home/user
    > -czf /home/user/.backup/kab.tar.gz .kde/share/apps/kabc
    > .kde/share/config/kaddressbookrc echo "...done"
    > echo "Backing up Kmail settings..."
    > tar -C /home/user
    > -czf /home/user/.backup/kmail.tar.gz .kde/share/apps/kmail
    > .kde/share/config/kmailrc echo "...done"
    > echo "Backing up Knode settings and messages..."
    > tar -C /home/user
    > -czf /home/user/.backup/knode.tar.gz .kde/share/apps/knode
    > .kde/share/config/knoderc echo "...done"
    > echo "Backing up your Skype settings..."
    > tar -C /home/user -czf /home/user/.backup/skype.tar.gz .Skype
    > echo "...done"
    > echo "Backing up all the .kde/share directory..."
    > tar -C /home/user -czf /home/user/.backup/kdeconf.share.tar.gz .kde/share
    > echo "...done"
    > echo "Backing up all the .kde/menus directory..."
    > tar -C /home/user -czf /home/user/.backup/kdeconf.menus.tar.gz .kde/menus
    > echo "...done"
    > echo "Backing up your documents..."
    > tar -C /home/user -czf /home/user/.backup/docs.tar.gz Documents
    > echo "...done"
    > echo "Backing up your mail messages..."
    > tar -C /home/user -czf /home/user/.backup/mail.tar.gz Mail
    > echo "...done"
    > echo
    > echo "Backup on hard disk is completed; writing now data to cd"
    >
    > #phase 2
    >
    > echo
    > echo "Creating ISO image of your backup"
    > mkisofs -R -ov /tmp/kde-user/bkp.iso /home/user/.backup
    > echo
    > echo "ISO image created"
    >
    > #phase 3
    >
    > echo
    > echo "blanking cd"
    > cdrecord -v dev=0,1,0 speed=2 blank=fast
    > echo
    > echo "cd blanked"
    >
    > #phase 4
    >
    > echo
    > echo "Writing data to cd"
    > cdrecord -v speed=2 dev=0,1,0 -multi -eject /tmp/kde-user/bkp.iso
    > echo
    > echo "Data written to cd"
    >
    > #phase 5
    >
    > rm /tmp/kde-user/bkp.iso
    > echo "Temporary ISO image removed"
    >
    > #phase 6
    >
    > rm /home/user/.backup/kopete.tar.gz
    > rm /home/user/.backup/kwin.tar.gz
    > rm /home/user/.backup/knotes.tar.gz
    > rm /home/user/.backup/kwallet.tar.gz
    > rm /home/user/.backup/cookies.tar.gz
    > rm /home/user/.backup/konq.tar.gz
    > rm /home/user/.backup/kab.tar.gz
    > rm /home/user/.backup/kmail.tar.gz
    > rm /home/user/.backup/knode.tar.gz
    > rm /home/user/.backup/skype.tar.gz
    > rm /home/user/.backup/kdeconf.share.tar.gz
    > rm /home/user/.backup/kdeconf.menus.tar.gz
    > rm /home/user/.backup/docs.tar.gz
    > rm /home/user/.backup/mail.tar.gz
    > echo "Hard disk backup .tar.gz files removed"
    > echo
    > echo "Backup has been written to cd"


    All you need now is a cron job that will move a robotic arm, pick up the CD,
    put it inside the case and back in the drawer...

    Well, to be a little more serious, you need to assign a timeslot for each
    job and allow enough time for the previous ones to end.

    Here is an example:

    Let us say you have a file named '.cron' your your home directory. The file
    includes:

    ======================
    # crontab for somebody, or something

    SHELL=/bin/sh
    PATH=/usr/local/bin:/bin:/usr/bin

    # create a back-up of important files
    30 19 * * * tar czvf /home/YOU/Important_files/-`date +%Y-%m-%d`.tar.gz
    /home/YOU/Important_files/

    # copy to server after 5 minutes
    35 19 * * * cp -r /home/YOU/Important_files/*.gz /home/server
    ======================

    You then run 'crontab ~/.cron' and the job will be run every day at 7:30 PM.

    Roy

    --
    Roy Schestowitz
    http://schestowitz.com

  11. Re: Kmail backup question

    Roy Schestowitz wrote:

    > All you need now is a cron job that will move a robotic arm, pick up the
    > CD, put it inside the case and back in the drawer...
    >
    > Well, to be a little more serious, you need to assign a timeslot for each
    > job and allow enough time for the previous ones to end.


    thanks, but a crontab doesn't really fit my needs.
    what I'd like to do is:
    1. put a cd-rw in my drive
    2. launch a script
    3. put the cd-rw back in the case

    as a home user, I am not sure that I have the pc switched on every day/week
    at a certain time...

    the alternative is to have a script that creates the tar.gz files, and then
    use k3b to burn the cd.

    I suppose that there must be a way to tell a script to wait to do something
    until the previous operation is over...

+ Reply to Thread