Before using Windows Server for file backups, Syncfolders is often used to implement incremental backups of files. Now the company's backup server replaced by the CentOS system, want to implement incremental backup thought of rsync. But previously in the study only used RSYNC-AV, unable to achieve incremental backup needs, but looked at the man. On the basis of the original-AV parameters, you also need to add-u and--delete parameter format: RSYNC-AUV--delete DTS SRC For example, you should/etc/backup to/bakup/should be written in RSYNC-AUV--delete/etc/ bakup/
Because the company's backup machine data will be regularly backed up to the mobile hard disk, so I wrote a corner. This can be achieved every time the operation of the mobile hard disk automatic mount, incremental backup, automatic uninstall and so on, and can be based on parameters (File/vedio) to decide which folder to back up. The code is as follows:
#!/bin/bash
#Bakup/dev/sdb1 ' s files (mounted on/samba/file_server) AND/DEV/SDC1 ' files (mounted on/samba/ Vedio_bakup to Udisk (mounted on/mnt
#Author: Cmzsteven
#Create date:2015-04-18
ismounted= ' Df|grep/dev /sdd1|wc-l '
If [$isMounted = 0]; then
mount-t ext4/dev/sdd1/mnt
Fi
Case $ in
' file '
Rsyn C-auv--delete/samba/file_server/mnt
;;
"Vedio")
Rsync-auv--delete/samba/vedio_bakup/mnt
;;
*)
Echo "The args only in file or veido!"
;; Esac
issuccess= ' echo $ '
If [$isSuccess = = 0]; then
umount-l/mnt
Fi
more Linux aspects Information please visit: http://www.aminglinux.com/bbs/?fromuid=4297