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.
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
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.
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.
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.
Do you need the rm ‘/home/shane/Ubuntu One/evolution-backup.tar.gz’ line in there? Can you not just overwrite the file?
I realised that afterwards and removed it on my machine.
use $HOME or $USER shell variables for homes or usernames and you will be cool
The problem with that is you cant do it in a cron job if you $HOME or $USER.
Revrote the script a bit, i’ll try to post it here:
#!/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
I really need to change my theme because the line break system doesnt really work.
You can use “/usr/lib/evolution/2.28/evolution-backup –backup evolution-backup.tgz”.
It works but only if the user runs it, its useless for a cron job.
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/
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.
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.
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
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.