- #! /bin/bash
- exec 1>/var/log/serverattbak.log 2>&1
- soudir=web:/home/www/attachments
- bakdir=/attachments/attbak/serverbak
- d=`date --date "-1 day" +%y%m%d`
- d2=`date +%y%m%d`
- w=`date +%w`
- rs=/usr/bin/rsync
- echo serverbak begin at `date`
- [ -d $bakdir/server-$w ] || mkdir $bakdir/server-$w
- if [ $w = "0" ]; then
- $rs -ar --delete $soudir/* $bakdir/server-$w/
- else
- $rs -ar $soudir/day_$d/ $bakdir/server-$w/day_$d/
- $rs -ar $soudir/day_$d2/ $bakdir/server-$w/day_$d2/
- /usr/bin/find $bakdir/server-$w/ -type f -mmin +1600 |xargs rm -f
- fi
- echo serverbak end at `date`
- 最新活动: 2016-02-19 17:44
- 浏览: 3505
- 关注: 0 人
编辑回复