linuxkurs/beispiele/11/rsync-backup.sh
2019-02-01 08:51:57 +01:00

17 lines
398 B
Bash

#!/bin/bash
USERNAME=XXX
REMOTE_HOST=XXX
# rsync options
# -a = Archive Mode
# -v = Verbode - für das log file
# -z = Compress
# -e = specify the remote shell to use
/usr/bin/rsync -avze 'ssh -i /home/$USERNAME/.ssh/rsync-key' $REMOTE_HOST:/home/$USERNAME/backups/* /local/backup/dir/ >> backup.log 2>&1
# delete backups older than 10 days
#find /local/backup/dir -mtime +10 -type f -delete