SVN轮滚备份脚本
svn轮滚备份脚本
说明: 保留7个备份,backup.1最新备份, backup.7最旧备份。
#!/bin/bash ################################### ### author: www.ttlsa.com ### ### QQ群: 39514058 ### ### E-mail: service@ttlsa.com ### ################################### SVN_REPOS=(/www/svn/web/*.ttlsa.com) BACKUP_BASE_DIR=/www/repo_backup backup_rotate() { if cd $1 then for num in 7 6 5 4 3 2 1 do old=`expr $num + 1` if [ -d backup.${num} ] then if [ -d backup.${old} ] then rm -rf backup.${old} && mv backup.${num} backup.${old} else mv backup.${num} backup.${old} fi fi done else echo "change BACKUP_DIR error!" exit 1 fi } for REPO in "${SVN_REPOS[@]}" do REPONAME=`/usr/bin/basename $REPO` BACKUP_DIR="$BACKUP_BASE_DIR/$REPONAME" [ -d "$BACKUP_DIR" ] || mkdir -p $BACKUP_DIR cd $BACKUP_DIR && backup_rotate $BACKUP_DIR /usr/bin/svnadmin hotcopy $REPO $BACKUP_DIR/backup.1 done
文章版权声明:除非注明,否则均为奥多云原创文章,转载或复制请以超链接形式并注明出处。
还没有评论,来说两句吧...