|
小弟近日给服务器做增量备份写脚本,遇到一些问题。
脚本如下
- #!/bin/sh
- #
- # u_files.sh This shell script is used to copy the daily upload files of COE to local backup DIR and Remote
- # Recovery Server
- #
- # Author Ronnie Ma ,Verican
- #
- # Modifications V.0.1 2008-09-29
- #-----------------------------------------
- #initlization
- #----------------------------------------
- FMS=/opt/tomcat5/verican/FMS
- BACKUP=/opt/tomcat5/verican/backup
- BAKDIR=/usr/local/backup/verican/upfiles
- #find the upgrade files and compress into tarball
- cd $FMS
- find . -type f -mtime -1 |xargs tar czvfp $BAKDIR/FMS`date +%F`.tar.gz
- if [ $? -eq 0 ];
- then
- cd $BACKUP
- find . -type f -mtime -1 |xargs tar czvfp $BAKDIR/BACKUP`date +%F`.tar.gz --exclude $BACKUP/activemq
- fi;
- #-------------------------------------------------------
- #copy the date to remote bacup server via command "scp"
- #-------------------------------------------------------
- rscp () {
- scp $BAKDIR/BACKUP`date +%F`.tar.gz $BAKDIR/FMS`date +%F`.tar.gz root@192.168.251.155:/usr/local/backup/verican/upfiles
- }
- rscp;
- ...
- ...
复制代码
发现用find +args 有时间总爱丢文件,不知为何,请问大家有没有更好的增量备份的方式,或是我这个脚本该怎么改进一下?
请指点一二,小弟先谢过了。 |
|