Skip to content

Commit

Permalink
don't define the trailing slash in $BACKUPDIR
Browse files Browse the repository at this point in the history
This way it is more clear, that `rsync` needs a trailing slash
  • Loading branch information
rubo77 authored Dec 13, 2021
1 parent 6df0e98 commit c61f405
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ This project maintains a list of directories and files you probably do not need

# define a Backup directory (with trailing slash!)
# some examples:
BACKUPDIR=/media/workspace/home/$USER/
BACKUPDIR=/media/$USER/linuxbackup/home/$USER/
BACKUPDIR=/media/$USER/USBSTICK/backup/home/$USER/
BACKUPDIR=/media/workspace/home/$USER
BACKUPDIR=/media/$USER/linuxbackup/home/$USER
BACKUPDIR=/media/$USER/USBSTICK/backup/home/$USER

# first specify the "-n" parameter so rsync will simulate its operation. You should use this before you start:
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/

# check for permission denied errors in your homedir:
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR|grep denied
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/ | grep denied

# if it is all fine, actually perform your backup:
rsync -aP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR
rsync -aP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/

You can edit the exclude file before execution:
- All lines starting with a `#` are ignored by rsync, i.e. those directories will be backed up.
Expand All @@ -37,7 +37,7 @@ You can edit the exclude file before execution:
When running locally or with the `--whole-file` option (for backups over SSH), rsync doesn't modify files but replaces them entirely. This allows us to create a snapshot directory (with hardlinks) with the state of the backup directory at a certain point in time.
Run this after finishing the `rsync` backup and it'll create a new snapshot:

BACKUPDIR=/media/workspace/home/$USER/
BACKUPDIR=/media/workspace/home/$USER
SNAPSHOT_DIR="$BACKUPDIR.snapshot_$(date +'%Y-%m-%d_%H%M%S' -u)"
cp -al $BACKUPDIR $SNAPSHOT_DIR

Expand Down

0 comments on commit c61f405

Please sign in to comment.