BackupPC-users

Re: [BackupPC-users] Parameter for incremental backups on localhost using tarCreate.sh script

2013-10-18 19:14:58
Subject: Re: [BackupPC-users] Parameter for incremental backups on localhost using tarCreate.sh script
From: Holger Parplies <wbppc AT parplies DOT de>
To: Phil Reynolds <phil-backuppc AT tinsleyviaduct DOT com>, Les Mikesell <lesmikesell AT gmail DOT com>
Date: Sat, 19 Oct 2013 01:11:35 +0200
Hi,

Phil Reynolds wrote on 2013-10-17 21:27:14 +0100 [Re: [BackupPC-users] 
Parameter for incremental backups on localhost using tarCreate.sh script]:
> On Thu, 17 Oct 2013 14:38:35 -0500 Les Mikesell <lesmikesell AT gmail DOT 
> com> wrote:
> > On Thu, Oct 17, 2013 at 1:30 PM, Phil Reynolds <phil-backuppc AT 
> > tinsleyviaduct DOT com> wrote:
> > > I am having problems backing up the localhost using a tarCreate.sh
> > > script - I can do full backups, but the date and time seems
> > > impossible to present properly for incrementals.
> > >
> > > $Conf{TarIncrArgs} = '--newer=$incrDate $fileList+' as recommended
> > > by the documentation fails to escape the space between the date and
> > > time. Leaving it at the default as for a remote host
> > > ($Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+') is also no
> > > good, as the unnecessary escaping makes the parameter so that tar
> > > fails to understand it.

getting quoting right is an endless source of fun ...

> > > The net result in both cases is a failed backup, because tar tries
> > > to stat something derived from the time, as if it was a filename.
> > >
> > > How can I get round this problem?
> > [...]
> The log shows:
> 
> Running: sudo /usr/local/bin/tarCreate.sh -v -f - -C / --one-file-system 
> --totals --newer=2013-10-13 08:36:07 . 

Basically, you would need to get quoting right within the shell script. I
don't really understand the need of a shell script, though. What, exactly, was
the point? It appears tarCreate.sh is adding a '-c' option. Your sudo rule can
enforce that just as well (and in a way less prone to creating security holes).

backuppc ALL=NOPASSWD: /bin/tar -c *

or even

backuppc ALL=NOPASSWD: /bin/tar -c -v -f - -C / --one-file-system --totals *

(the "*" means "along with any other (optionally) following parameters"; you
can even put that at the end of a parameter, e.g. if you need to backup
several shares under /home - "... -C /home/*").

If you drop the script and just use sudo, you would need $incrDate and
$fileList without a "+".

Les Mikesell wrote on 2013-10-17 17:35:36 -0500 [Re: [BackupPC-users] Parameter 
for incremental backups on localhost using tarCreate.sh script]:
> [...]
> If you mean the one with:
> exec /bin/tar $*
> I think that should be $@ to maintain the positional arguments.

It's actually "$@" (with the quotes).

> Personally, I would just use rsync over ssh like any other target and
> not worry about the CPU doing a little extra work.  It's probably not
> doing much else then anyway...

While I agree with rsync, I don't see the point of ssh, and you're completely
ignoring the fact that there was some thought behind using the script - as if
you were trying to "trick" Phil into getting rid of it. You also seem to be
missing that it's a local backup, so the CPU is probably doing compression
(as well as both sides of the ssh), and it might even be running concurrent
backups.

While replacing tar with rsync *inside* the script avoids the problem of
needing to escape the date, it does *not* avoid needing to escape the
$argList. While you might get away with an incorrect setting as long as
there happens to be nothing requiring quoting, you'll be surprised some
day when it stops working because you change your backup set, so do
yourself a favour and get it right now, whether with tar or with rsync.

Regards,
Holger

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
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/