#!/bin/bash # SETTING TOEMAIL="cxhjj@163.com"; COMMENT='test home www backup' DIR='svn' # END SETTING TMP='/tmp/diabak/'${DIR} ATTTMP='/tmp/diabakatt/'${DIR} rm -rf $TMP mkdir -p $TMP cd $TMP # Put files what you want to backup to $TMP cp -r /home/www/ $TMP # Don't change anything below YYYYMMDD=`date +%Y%m%d` SUBJECT='DiaBak_of_'${DIR}'_'${YYYYMMDD}; rm -rf $ATTTMP mkdir -p $ATTTMP cd $ATTTMP tar zcPf backup.tar.gz $TMP rm -rf $TMP split -b 20m -a 3 -d backup.tar.gz ${SUBJECT}.part rm -f backup.tar.gz for file in * do echo $COMMENT | mutt -s $SUBJECT $TOEMAIL -a $file sleep 30s done rm -rf $ATTTMP
下载
http://xsvps.googlecode.com/files/daybackup.sh
crontab -e
00 00 * * * /home/daybackup.sh
建议 59 11 意思11:59
文章评论