BackupPC-users

Re: [BackupPC-users] Wildcard support in BackupFilesOnly/BackupFilesExclude

2016-05-29 17:02:20
Subject: Re: [BackupPC-users] Wildcard support in BackupFilesOnly/BackupFilesExclude
From: Dmitry Katsubo <dma_k AT mail DOT ru>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Sun, 29 May 2016 23:01:28 +0200
On 2016-05-02 19:23, Dmitry Katsubo wrote:
> On 2016-04-29 15:20, Bowie Bailey wrote:
>> On 4/29/2016 7:04 AM, Dmitry Katsubo wrote:
>>> Hello everyone,
>>>
>>> I wonder if there is any support for wildcards in 
>>> BackupFilesOnly/BackupFilesExclude
>>> configuration options? This has been raised several times in this maillist
>>> (see [1]-[5]) and seems to be a desired feature. However for me personally 
>>> it
>>> does not work. I am using BackupPC to backup files locally:
>>>
>>> Running: /usr/bin/sudo /bin/tar -c -v -f - -C /var --totals 
>>> --exclude=./proc ./lib/cacti ./lib/dpkg ./www/*.ini
>>> full backup started for directory /var
>>> [ skipped 5680 lines ]
>>> /bin/tar: ./www/*.ini: Cannot stat: No such file or directory

I decided to play with $Conf{TarClientCmd} variable, which in my case is:

$Conf{TarClientCmd} = '/usr/bin/sudo $tarPath -C $shareName -c -v -f - 
--totals';

I tried this way

$Conf{TarClientCmd} = 'cd $shareName && /usr/bin/sudo $tarPath -c -v -f - 
--totals';

and this way

$Conf{TarClientCmd} = 'bash -c "cd $shareName && /usr/bin/sudo $tarPath -c -v 
-f - --totals"';

but they all fail - it seems like BackupPC uses exec() call and not shell
invocation. So I have written a small wrapper to solve the problem of
wildcard expansion:

$Conf{TarClientCmd} = '/etc/backuppc/tar_wrapper.sh $shareName+ $tarPath -c -v 
-f - --totals';                             
$Conf{TarFullArgs} = '$fileList';                                               
                                          
$Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList';                            
                                          

=== begin tar_wrapper.sh ===
#!/bin/bash

if [ $# -lt 3 ]
then
        echo "Wrong number of arguments."
        exit 1;
fi

cd "$1" || exit

shift

eval /usr/bin/sudo $@
=== end ===

Special cases (like spaces in filenames) should be taken care in configuration
(e.g. './world\ wide\ web/*.ini') - honestly I have not explored such case
closer.

-- 
With best regards,
Dmitry

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>