Solved

Automated Backups in Linux (Duplicity)

Posted on 2008-10-25
7
1,409 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
synology Replace Drives to Expand Storage Capacity 8 87
Install XRDP on Ubuntu Server 16.10 x64 3 61
postfix start error! 9 54
Understanding ping command in Ubuntu 5 31
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

749 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