53 lines
2.1 KiB
Markdown
53 lines
2.1 KiB
Markdown
# duplicity
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
# Prerequisites
|
|
## ssh without password (using ssh-keygen)
|
|
|
|
# Setup schedule
|
|
## create a symbolic link ln -s [source-path/duplicity-backup.sh] /etc/cron.daily/mybackup
|
|
|
|
suffix=$(date +"%Y%m%d%H%M%S")
|
|
encryptKey=zzzzzzz
|
|
|
|
## home
|
|
duplicity --encrypt-key ${encryptKey} remove-all-but-n-full 8 --force sftp://mfadmin@192.168.1.251://backups/devices/homeserver/duplicity/home 2>&1 | tee /var/log/backup_home_${suffix}.log
|
|
duplicity --encrypt-key ${encryptKey} --verbosity info --full-if-older-than 7D /home\
|
|
--exclude '**/cache'\
|
|
--exclude '**/.cache'\
|
|
--exclude '**/tmp'\
|
|
--exclude '**/.tmp'\
|
|
sftp://mfadmin@192.168.1.251://backups/devices/homeserver/duplicity/home\
|
|
2>&1 | tee /var/log/backup_home_${suffix}.log
|
|
|
|
## etc
|
|
duplicity --encrypt-key ${encryptKey} remove-all-but-n-full 8 --force sftp://xxx@192.168.1.111://backups/devices/homeserver/duplicity/etc 2>&1 | tee /var/log/backup_etc_${suffix}.log
|
|
duplicity --encrypt-key ${encryptKey} --verbosity info --full-if-older-than 7D /etc\
|
|
--exclude '**/cache'\
|
|
--exclude '**/.cache'\
|
|
--exclude '**/tmp'\
|
|
--exclude '**/.tmp'\
|
|
sftp://mfadmin@192.168.1.251://backups/devices/homeserver/duplicity/etc\
|
|
2>&1 | tee /var/log/backup_etc_${suffix}.log
|
|
|
|
## root
|
|
duplicity --encrypt-key ${encryptKey} remove-all-but-n-full 8 --force sftp://xxx@192.168.1.111://backups/devices/homeserver/duplicity/root 2>&1 | tee /var/log/backup_root_${suffix}.log
|
|
duplicity --encrypt-key ${encryptKey} --verbosity info --full-if-older-than 7D /root\
|
|
--exclude '**/cache'\
|
|
--exclude '**/.cache'\
|
|
--exclude '**/tmp'\
|
|
--exclude '**/.tmp'\
|
|
sftp://mfadmin@192.168.1.251://backups/devices/homeserver/duplicity/root\
|
|
2>&1 | tee /var/log/backup_root_${suffix}.log
|
|
|
|
## data
|
|
duplicity --encrypt-key ${encryptKey} remove-all-but-n-full 12 --force sftp://xxx@192.168.1.111://backups/devices/homeserver/duplicity/data 2>&1 | tee /var/log/backup_data_${suffix}.log
|
|
duplicity --encrypt-key ${encryptKey} --verbosity info --full-if-older-than 7D /data\
|
|
sftp://mfadmin@192.168.1.251://backups/devices/homeserver/duplicity/data\
|
|
2>&1 | tee /var/log/backup_data_${suffix}.log
|
|
|
|
```
|