discuz论坛附件递增备份脚本

回复 收藏
  1. #! /bin/bash
  2. exec 1>/var/log/serverattbak.log 2>&1
  3. soudir=web:/home/www/attachments
  4. bakdir=/attachments/attbak/serverbak
  5. d=`date --date "-1 day" +%y%m%d`
  6. d2=`date  +%y%m%d`
  7. w=`date +%w`
  8. rs=/usr/bin/rsync
  9. echo serverbak begin at `date`
  10. [ -d $bakdir/server-$w ] || mkdir $bakdir/server-$w
  11. if [ $w = "0" ]; then
  12.         $rs -ar --delete $soudir/* $bakdir/server-$w/
  13. else
  14.         $rs -ar $soudir/day_$d/  $bakdir/server-$w/day_$d/
  15.         $rs -ar $soudir/day_$d2/  $bakdir/server-$w/day_$d2/
  16.         /usr/bin/find $bakdir/server-$w/ -type f -mmin +1600 |xargs rm -f
  17. fi
  18. echo serverbak end at `date`
2011-04-20 10:14 举报
已邀请:
0

lyhabc

赞同来自:

     /usr/bin/find $bakdir/server-$w/ -type f -mmin +1600 |xargs rm -f

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: