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
Solved

Automated Backups in Linux (Duplicity)

Posted on 2008-10-25
7
1,400 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

861 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