34 lines
1.5 KiB
Plaintext
34 lines
1.5 KiB
Plaintext
#What is this
|
|
This is a docker for a cron job that runs rsync to backup folders.
|
|
the backup.sh is the backup script but the cronjob call list.sh which thenc calls backup.sh
|
|
this is to make listing multiple folders easier.
|
|
|
|
#Setup
|
|
#Source and destination
|
|
On docker compose you'll find volumes
|
|
```
|
|
volumes:
|
|
- /path/to/sources/:/source/
|
|
- /path/to/backups/:/backup/
|
|
```
|
|
change `path/to/source` and `path/to/backups` to the paths where the folders you'll want to backup are and where the backup is going to
|
|
|
|
##List
|
|
```
|
|
/usr/local/bin/backup.sh /source/project1 /backup/project1-backup --keep-trash=false --rsync-delete=true
|
|
```
|
|
this is the list the cronjob will run.
|
|
`/usr/local/bin/backup.sh` is just the name of the backup script, does not need change
|
|
`/source/project1` Param 1 is the folder you want a backup of, if need change
|
|
`/backup/project1-backup` Param 2 is the folder where the backup will go
|
|
`--keep-trash=false` Param 3 is if a "trash" folder will be kept, this means that any file deleted from the source folder will have it's latest backup moved to a "trash" folder where it'll stay for 30 days, after that, it too will be deleted
|
|
`--rsync-delete=true` Param 4 if used, delete flag will be called for rsync, deleting any file on backup folder that has been deleted from souce
|
|
|
|
if both are false, then any deleted files will be kept indefinitely in the backup folder.
|
|
|
|
|
|
#Building and running
|
|
build with
|
|
`docker build -t cron-backuper .`
|
|
and use `docker compose up` to bring it up(it's easier to config volumes that way)
|