linuxkurs/beispiele/11/rsync-backup.sh

17 lines
398 B
Bash
Raw Normal View History

2019-02-01 08:51:57 +01:00
#!/bin/bash
USERNAME=XXX
REMOTE_HOST=XXX
# rsync options
# -a = Archive Mode
2019-02-04 10:38:01 +01:00
# -v = Verbose - für das log file
2019-02-01 08:51:57 +01:00
# -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