1 |
Hello, |
2 |
|
3 |
> I was looking at this rotating backup script |
4 |
> |
5 |
> source: |
6 |
> https://community.spiceworks.com/topic/34970-how-to-create-rotating-backups-of-files |
7 |
> |
8 |
> ----------backup script---------------- |
9 |
> BACKUPDIR=`date +%A` |
10 |
> OPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES |
11 |
> --delete --backup --backup-dir=/$BACKUPDIR -a" |
12 |
> |
13 |
> export PATH=$PATH:/bin:/usr/bin:/usr/local/bin |
14 |
> |
15 |
> # the following line clears the last weeks incremental directory |
16 |
> [ -d $HOME/emptydir ] || mkdir $HOME/emptydir |
17 |
> rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/ |
18 |
> rmdir $HOME/emptydir |
19 |
> |
20 |
> # now the actual transfer |
21 |
> rsync $OPTS $BDIR $BSERVER::$USER/current |
22 |
> -------end backup script---------------- |
23 |
> |
24 |
> Can anybody explain why they they "...clear the last weeks incremental directory"? |
25 |
|
26 |
Probably because BACKUPDIR is set to the name of the day (`date +`A`). |
27 |
Today is Tuesday and a backup is done, next week the backup will be |
28 |
overwritten because BACKUPDIR will also be Tuesday. Therefore there will |
29 |
only be 7 directories. |
30 |
|
31 |
> Doesn't "rsync --deleate" option take take care of this? |
32 |
|
33 |
--delete removes extraneous files. Combined with the previous thing, it |
34 |
ensures the backup rotation. |
35 |
|
36 |
> Does it have something to do with Windows? |
37 |
|
38 |
Hu? What is Windows? I do not know what are those alternative OSs ;) |
39 |
|
40 |
Regards, |
41 |
|
42 |
JC |