Evolution backup

I was looking into backing up evolution on to ubuntu one so I tried a few things and this is what I came up with by looking at how evolution itself does it.

#!/bin/sh
rm '/home/shane/Ubuntu One/evolution-backup.tar.gz'
evolution --force-shutdown
rm /home/shane/.evolution/.running
gconftool-2 --dump /apps/evolution > /home/shane/.evolution/backup-restore-gconf.xml
cd /home/shane && tar chf - .evolution .camel_certs | gzip > '/home/shane/Ubuntu One/evolution-backup.tar.gz'
evolution

Just replace shane with your home folder’s name. I put it in /etc/cron.daily so it backs up every day. Its only down for a few seconds but its great to have a backup of everything.

Note: It should give out an error that the .camel_certs file isnt there but it still works. I dont know if its needed or not but since its in the script evolution runs I left it in.

This entry was posted in Ubuntu and tagged , . Bookmark the permalink.

18 Responses to Evolution backup

  1. Alexey Fisher says:
    Firefox 3.5.3GNU/Linux

    You can use:
    tar cvfz backup.tar.gz file file
    or:
    tar cvfj backup.tar.bz2 file file
    instead of pipe:
    tar chf – … | gzip > …

    So it’s looks like
    tar cvfz /home/shane/Ubuntu\ One/evolution-backup.tar.gz .evolution .camel_certs

  2. Marcus says:
    Firefox 3.0.14GNU/Linux

    If you make use of LVM snapshots, you will have a seamless backup without having to shut down anything at all.
    Works on almost everything.

  3. Karl Relton says:
    MSIE 7.0Windows XP

    Evolution itself has a backup function from the UI that produces a complete tar file. The issue is executing that from a cronjob. Maybe evolution needs a new plugin or command line option to run its function at regular intervals.

    • Shane says:
      Firefox 3.5.3GNU/Linux

      Well the backup function in evolution does the exact same thing as what I have above. I couldnt find a plugin or option to do it.

  4. TGM says:
    Firefox 3.5.3GNU/Linux

    Do you need the rm ‘/home/shane/Ubuntu One/evolution-backup.tar.gz’ line in there? Can you not just overwrite the file?

    • Shane says:
      Firefox 3.5.3GNU/Linux

      I realised that afterwards and removed it on my machine.

  5. alex says:
    Safari GNU/Linux

    use $HOME or $USER shell variables for homes or usernames and you will be cool

    • Shane says:
      Firefox 3.5.3GNU/Linux

      The problem with that is you cant do it in a cron job if you $HOME or $USER.

  6. GNa says:
    Epiphany 2.22GNU/Linux

    Revrote the script a bit, i’ll try to post it here:

  7. GNa says:
    Epiphany 2.22GNU/Linux


    #!/bin/bash
    USERNAME=shane
    BACKUP_FILE="/home/${USERNAME}/Ubuntu One/evolution-backup.tar.gz"
    if [ -f "${BACKUP_FILE}" ]
    then
    rm "${BACKUP_FILE}"
    fi
    evolution --force-shutdown
    rm /home/${USERNAME}/.evolution/.running
    gconftool-2 --dump /apps/evolution > /home/$USERNAME/.evolution/backup-restore-gconf.xml
    cd /home/${USERNAME} && tar czhf "${BACKUP_FILE}" .evolution `if [ -d .camel_certs ]; then echo .camel_certs; fi`
    evolution &
    disown

    • Shane says:
      Firefox 3.5.3GNU/Linux

      I really need to change my theme because the line break system doesnt really work.

  8. Santiago Otero says:
    Firefox 3.5.3GNU/Linux

    You can use “/usr/lib/evolution/2.28/evolution-backup –backup evolution-backup.tgz”.

    • Shane says:
      Firefox 3.5.3GNU/Linux

      It works but only if the user runs it, its useless for a cron job.

  9. GNa says:
    Epiphany 2.22GNU/Linux

    Hello, i published the script in my blog, i just have a note to is, maybe someone has a solution. I have to note, that this way Evolution gets started after the backup is done, even if you have scheduled it to run at night. I think the intention was to start the backgroud processes that were stopped with evolution –force-shutdown. — http://blog.gnanet.net/2009/10/01/evolution-backup-angolenglish/

  10. sawrub says:
    Firefox 3.5.3GNU/Linux

    Better not to delete the old backed-up tar before making in a new one.
    I also did implemented a bash script for the similar function for thunderbird, with date postfixed to the tar and used to keep last 2 backed up tar’s before removing others,and that also only when the tar for today is successfully created.
    Can share that if needed.

  11. George Walsh says:
    Firefox 3.6GNU/Linux

    I’ve followed this thread with some interest. I have a group of users with evolution mboxes (local delivery) on a development server. Every thing is backed up on alternate disc surfaces nightly using rsync scripts.

    Yet at times in the past evolution files have become scrambled and rebuilding them is not a fun job, even when the source is protected.

    I’d love to automate a separate backup of evolution files using its own backup/restore service, but that would seem to rule out a cron job script when more than one user is involved. Would it be preferable to write a script derived from the discussion above, where evolution is forced stop the one time and then each user’s files modified one by one, or is it better practice to schedule a separate job for each user?

    Of course, in either case, the resulting compressed backup files would themselves be backed up by the system-wide rsync jobs.

  12. Thomas de Graaff says:
    Firefox 3.0.17GNU/Linux

    Evolution provides a possibility to backup and restore from the commandline.

    On your system do:

    locate evolution-backup

    then path to evolution-backup/evolution-backup –help

    you can backup by:

    <path to evolution-backup executable./evolution-backup –backup

    • Michael says:
      Chromium 5.0.375.70GNU/Linux

      Thomas, what the evolution-backup executable does is already said at top.
      The problem is running a backup from a cronjob. This can be done taking evolution-backup as an advice what to backup, but include a few precautions inside your own (cron-) script.
      If you like, find details on my site.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>