Re: [Hampshire] Re: Automating rsync to run as root

Top Page

Reply to this message
Author: Damian Brasher
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Re: Automating rsync to run as root
Russell Gadd wrote:
> Ok I'll copy the script below (not sure what the HantsLUG Wiki is).
>
> A few comments first. This is my first (currently also my latest!) script.
> You will see I used sed to strip commas from my filespecs - this was part
> of
> an attempt to try to deal with filespecs with spaces in, but my
> rudimentary
> bash skills failed me - I couldn't get tar to accept what I gave it when
> there were spaces in. I have resolved not to use spaces in names from now
> on. The script might need a bit more tweaking for robustness, but it does
> work ok.


Hi Russell

Been a bit busy and just come across this post again. The script is
interesting. Did you post it on the wiki after all? Can I suggest you make
sure you add some more comments explaining what you are doing, i.e.

you use rsync -rltD --delete --modify-window=3601

why are you using the --modify-window=3601 for example for robustness.

To ensure others can use your script you should consider using positional
parameters so a user can specify on the command line which directories
will be operated on, both directories to be backed up and to where.

Also have you set this this shell option: shopt -s -o nounset - to ensure
you get an error message when you try to expand a variable that has not
been set / declared / initialised? i.e. as a catch all - I'm wondering if
this is a default in bash or not.

Sorry for pickiness but it was an itch I had to scratch:)

Damian

--
Damian Brasher
www.interlinux.co.uk
All mail scanned by clam-av http://www.clamav.net/