Bash
#!/bin/bash
source=/home/tkoehler/Dokumente/
target=/mnt/nuketown/Dokumente
date=`date "+%Y-%m-%dT%H:%M:%S"`
cd /mnt/nuketown/
function backup() {
rsync -rvu $source $target --link-dest=/mnt/nuketown/misc/.backup_daily.0
}
function rotate_daily() {
cd /mnt/nuketown/misc
mv .backup_daily.6 .backup_daily.7
mv .backup_daily.5 .backup_daily.6
mv .backup_daily.4 .backup_daily.5
mv .backup_daily.3 .backup_daily.4
mv .backup_daily.2 .backup_daily.3
mv .backup_daily.1 .backup_daily.2
mv .backup_daily.0 .backup_daily.1
}
function rotate_weekly
mv .backup_daily.7 .backup_weekly.$(date --date="-1 week")
mkdir .backup_daily.7
function doc_sync () {
rsync -rvu /mnt/nuketown/misc/Dokumente/ tkoehler@10.24.6.2::trainstation/Dokumente
rsync -rvu tkoehler@10.24.6.2::trainstation/Dokumente /mnt/nuketown/misc/Dokumente
}
Alles anzeigen
Auf die Schnelle zusammengehackt. Brauche endlich ne Rotation bei den Backups