[Hampshire] Re ... Automating rsync to run as root (Damian B…

Top Page

Reply to this message
Author: Russell Gadd
Date:  
To: hampshire lug
Subject: [Hampshire] Re ... Automating rsync to run as root (Damian Brasher)
>
> 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
>


Hi Damian

Thanks for the interest. No I haven't posted it on the Wiki. I did view the
video about wikis which was very useful as I haven't used one. I may yet do
something on this as more than one of you has expressed an interest.

The topic would actually be how I intend to set up my system to make the
transition from Windows to Linux - my idea is to do this gradually over an
extended time period for various reasons and so I want a system solution
which uses both OS's for "production" work. Once I have the nuts and bolts
in place I will then explore Linux alternatives to Windows applications and
gradually do more and more in Linux. This avoids a big-bang changeover which
I don't have the energy for and also gives me time to work with each
application until I am happy it is efficient in Linux. At present I am still
working towards what I see as a minimal Linux system to do real work on - it
has to have good backup as a prerequisite. I also regard documentation as
important since I tend to forget details on things I'm not doing every day.
For example I have a 16 page text document on how to reinstall Windows and
all my apps which covers partitioning, backups, application installation and
customisation of the Windows interface. I intend to work up a similar set of
documentation on Linux as I learn how to do different things (like
repositories and sources.list, partitions and fstab, etc).

If I do add to your wiki, first it won't be very soon as I don't work on
this very frequently, and second I want to get my initial working system
together before I post it. It will include how I partition the drives and
including brief mention of the multi-boot manager I use which also can
create, modify and image partitions, which dovetails into how I need to
backup the system.

Yes I will tart up my script to include better comments. I'm not entirely
sure what positional parameters are, but my scheme doesn't need to be able
to specify directories on the command line. It's not intended for expert
"on-the-fly" use but more for a semi-automatic procedure ( i.e. the user
hits an icon to invoke it, but doesn't have to worry about what needs
backing up). However the directories to back up are selectable within the
header of the script not in the actual working code. This system relies on
the user saving his documents, etc in a certain place (I use a subdirectory
of my home directory - this is because this is actually on a different
partition and means the OS image I take excludes user documents keeping it
smaller and less in need of encryption for example). I'm likely to do
something similar for making CD backups (the backup procedure in my first
script is for daily backup to a second drive and a USB stick - a more
permanent weekly backup is needed in addition). This will be encrypted in
case the CD goes walkies.

The --modify-window=3601 is because of time differences between my Linux
system and my Windows system mainly due to daylight saving adjustment. It
ensures files aren't missed just because of these differences (1 hour + 1
second). The 1 second is due to a different time granularity (if my memory
serves me). Using a bigger number than necessary just means I might be
resyncing a file unnecessarily, making the procedure a fraction of a second
less efficient.

shopt -s -o nounset is recommended from "Linux Shell scripting with Bash" by
Ken O Burtch which I have tried to use to start me off with Bash. As I
remember it, it is intended to make sure something isn't accidentally
treated as a variable which you didn't intend to. (Reminds me of programming
in BASIC!). Sometimes having misspelled a variable can produce a bug which
takes a long time to discover if you don't do this sort of thing.

Being picky is in my view a virtue in building good reliable systems - feel
free to scratch as much as you like.

Regards
Russell