[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync --delete



On Sat, Oct 17, 2020 at 03:01:13PM -0700, David Christensen wrote:
>
> Is /sda the mount point for your backup media?  If so, that is confusing --
> 'sda' implies '/dev/sda', which should be your system drive (e.g. root).  I
> would label the backup filesystem 'backup-rpi4b' and mount it at
> '/mnt/backup-rpi4b' or '/media/backup-rpi4b' (your desktop might be able to
> do this for you).

I'm a lousy/lazy typist so mount a USB flash drive at /dev/sda1 on /sda.

> If the script must change the working directory, I would display that --
> 'set -x', 'cd ...', and 'set +x'.

I did adopt this suggestion.

> I would do an old-school 'if' block and display that a directory is being
> created -- 'set -x', 'mkdir ...', 'set +x'.


> What is /mc?

/mc is simply a directory I put docs/scripts I create and/ or collect
that are not part of any installation.
There is an /mc/docs/, an /mc/bin/ and a couple of others, sometimes.

> mk_rsync_exclude.sh creates '.rsync_exclude' in the current working
> directory?

Yes.

> > echo /usr/bin/rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike
> > /usr/bin/rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike ||
> >      echo rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike    Failed $? ;

> You cut and pasted the following code three times:
>
>    /usr/bin/rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike
>
> DRY:     https://en.wikipedia.org/wiki/Don%27t_repeat_yourself

I've seen this just haven't it ingrained yet.

> I prefer 'set -x', 'command ...', and 'set +x' when I want to see what the
> shell is actually doing (which might not be the same output as 'echo ..').

and this one.

>
> I use 'set -e' at the top of my scripts so that the shell will stop and
> display an error message if a script command fails.
>
>
> /usr/bin/rsync -- I also use absolute paths for tools.  But, I put them into
> upper-case variables at the top of my script.
>
> --exclude-from -- It is too easy to screw up exclude specifications and
> exclude a file you need.  Therefore, I backup entire filesystems.

We have different needs.

> When invoking rsync(1), I make sure that SRC and DEST are directories, that
> their paths are absolute, and that their paths end with '/'.  This prevents
> confusion and works as I expect.

> David

I've taken several of your suggestions.
Thanks for the feedback.
Be well,
Mike
--
    If everything seems to be going well, you have obviously overlooked something........


Reply to: