发现一个rsync同步神器(linux下文件夹同步增量备份神器)

全名:

Rsync time backup


其实就是rsync+time machine,原理就是简化了rsnyc操作,可以实现增量备份。


常用命令:

sh rsync.sh /home/www/mztine.com /home/www/mztine_back

rsync_tmbackup.sh -p 2222 /home user@example.com:/mnt/backup_drive

rsync_tmbackup.sh user@example.com:/home /mnt/backup_drive


cron脚本,自动检测执行任务:

0 */1 * * * if [[ -d /mnt/backup ]]; then rsync_tmbackup.sh /home /mnt/backup; fi


rsync time backup语法大全说明:

Usage: rsync_tmbackup.sh [OPTION]... <[USER@HOST:]SOURCE> <[USER@HOST:]DESTINATION> [exclude-pattern-file]

Options
-p, --port           SSH port.
-h, --help           Display this help message.
--rsync-get-flags    Display the default rsync flags that are used for backup.
--rsync-set-flags    Set the rsync flags that are going to be used for backup.
--log-dir            Set the log file directory. If this flag is set, generated files will
                     not be managed by the script - in particular they will not be
                     automatically deleted.
--strategy           Set the expiration strategy. Default: "1:1 30:7 365:30" means after one
                     day, keep one backup per day. After 30 days, keep one backup every 7 days.
                     After 365 days keep one backup every 30 days.
--no-auto-expire     Set option to disable automatically purging old backups when out of space.


除非特别注明,本站所有文字均为原创文章,作者:matrix