Linux?μí3é?·?3£êμó?μ??¨?ú±?·Y??±?

来源:未知 责任编辑:责任编辑 发表时间:2014-05-26 11:00 点击:

?ò???úí???1¤×÷?D£?3£3£òa±?·Yò?D?×êá?£???è?ê??é2??′?ó£?μ?ê?oü·?ê±??μ?£??ò?ú?aà?·??íò???Linux±?·Y??±?£??á?é×?è?μ?êμ??×??ˉ±?·Y£?2¢?ò?éò? ±£á?Nìì±?·Yμ?μμ°??£?a????±?·??aá??????t£?ò???ê??′DD???tbackup.sh£?áíò???ê?±?·Y???????tproject.lst?£

 

backup.sh?à1??μ?÷

??òa2?êy?μ?÷

\

 

???t?úèY

#!/bin/bash

#author:        InBi

#date:          2011-08-05

#role:          backup files periodically.

#website:       http://www.itwhy.org/2011/07-28/707.html

##################################################

LogFile=/backup/log/`date +"%Y-%m"`.log

SourceDir=/var/RDfile

BakDir=/backup

RetainDay=20

ProjectLst=/backup/project.lst

##################################################

DATE=`date +"%Y-%m-%d"`

echo "backup start at $(date +"%Y-%m-%d %H:%M:%S")" >$LogFile

echo "--------------------------------------------------" >>$LogFile

cd $BakDir

PROJECTLIST=`cat $ProjectLst`

for Project in $PROJECTLIST

do

       ProjectData=$SourceDir/$Project

       DestDir=$BakDir/$Project

       PackFile=$DATE.$Project.tgz

       if [ -f $BakDir/$PackFile ]

       then

              echo "backup file have exist !" >>$LogFile

       else

              cp -RHpf $ProjectData $DestDir >/dev/null

              tar -zcvf $PackFile $Project >/dev/null

              echo "backup $Project done into $PackFile" >>$LogFile

              rm -rf $Project

       fi

done

find $Bakdir -type f -mtime +$RetainDay -name "*.$Project.tgz" -exec rm {} \; >/dev/null

echo "--------------------------------------------------" >>$LogFile

echo "backup end at $(date +"%Y-%m-%d %H:%M:%S")" >>$LogFile

echo " " >> $LogFile

exit 0

 

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • /etc/fstab 详解
  • nginx主主集群
  •  LVS-NAT和LVS-DR模式的实现详解
  •  RHCE考试之磁盘配额
  • 学习笔记:ACL详解
  •  LVM逻辑卷管理器
  • suse linux双网卡双网关配置
  •  Nginx主主负载均衡架构
  • ubuntu学习Mysql

快速直达

操作系统导航

LinuxWindows虚拟机
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1