Solved

Automated Backups in Linux (Duplicity)

Posted on 2008-10-25
7
1,424 Views
Last Modified: 2013-12-16
Hi!

I'm using Duplicity ( http://duplicity.nongnu.org/ ) to automatically backup my files.

The following command will backup all of my users' website files and preferences (e.g. Spamassassin prefs) to a separate drive:

duplicity -v8 /var/www file:///backup/duplicity/var/www

What I need is to exclude all the temporary files. Temporary files are all inside a directory called "phptmp" and there is one of these directories per user, e.g.

/var/www/web1/phptmp/
/var/www/web2/phptmp/
/var/www/web3/phptmp/
/var/www/web4/phptmp/

My question is: what is the syntax I need to exclude all these temp folders?

0
Comment
Question by:Julian Matz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 16

Accepted Solution

by:
ai_ja_nai earned 500 total points
ID: 22805274
--exclude /destination/dir option does the job. You may use wildcards to generalize your choice.
Also, --exclude-filelist /path/to/file.txt lets you define a plain text file with directories listed inside, separed by returns.
Look for the manual file on duplicity website
0
 
LVL 21

Author Comment

by:Julian Matz
ID: 22806430
Thanks. I have looked through the manual numerous times but couldn't find the answer. Do you know how a wildcard would be applied exactly?
This is where the wildcard would need to be placed (*):

--exclude /var/www/web*/phptmp

Or would it have to be? :

--exclude /web*/phptmp

I didn't know that you need to take the destination path when using --exclude ...
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 22806904
well, you have to use absolute paths so --exclude /var/www/web*/phptmp is a correct approach, in my opinion. Wildcards may be used also to specify depth of exclusion: --exclude /var/www/** <-- this will exclude everything in two level deep recursive search; *** will exclude in three levels deep and so on.
You finally may use such things like --exclude ignorecase:/usr/[a-z0-9]foo/*/**.py to take advantage of full reg exp matching power. Here we told him to exclude case insensitively any folder in /usr/*foo/*/**.py. Note how we told it to match any alphanumeric chars in foo via [a-z0-9].

But if you just need to exclude specific dirs I belive that specifying  a filelist would be the most easy and effective way
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 21

Author Comment

by:Julian Matz
ID: 22862817
Thanks. Being as these temp directories might change (if users are added or deleted), I wouldn't be able to use a static filelist.

Can I use standard regular expressions?

Would this work for me?

duplicity -v8 /var/www --exclude /var/www/web[0-9]+/phptmp file:///backup/duplicity/var/www
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 22865613
Mhh. Actually does exist the regex support, but in a separate rsync patch under development...
With the options we have now, In a scenario where only the folder "webN" changes, try
 --exclude /var/www/*/phptmp/   <---include always the slash, if it's not a file
This will exclude any folder called phptmp/ two levels below a base directory called /var/www/

We have to use this because pattern expansion with + doesn't match. Only * can match any numer of charachters.
Is this ok?
0
 
LVL 21

Author Comment

by:Julian Matz
ID: 22965930
Thanks! I'm giving this a try now and will let you know how I get on.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question