复制代码
- #!/bin/bash#author:InBi#date:2011-07-28#role:backupfilesperiodically.#website:http://www.itwhy.org/2011/07-28/707.html##################################################LogFile=/backup/log/`date+"%Y-%m"`.logDATE=`date+"%Y-%m-%d"`SourceDir=/var/RDfileBakDir=/backupRetainDay=20ProjectLst=/backup/project.lst##################################################echo"backupstartat$(date+"%Y-%m-%d%H:%M:%S")">$LogFileecho"--------------------------------------------------">>$LogFilecd$BakDirPROJECTLIST=`cat$ProjectLst`forProjectin$PROJECTLISTdoProjectData=$SourceDir/$ProjectDestDir=$BakDir/$ProjectPackFile=$DATE.$Project.tgzif[-f$BakDir/$PackFile]thenecho"backupfilehaveexist!">>$LogFileelsecp-RHpf$ProjectData$DestDir>/dev/nulltar-zcvf$PackFile$Project>/dev/nullecho"backup$Projectdoneinto$PackFile">>$LogFilerm-rf$ProjectfiOldFile="$BakDir/"$(date--date="$RetainDaydaysago"+"%Y-%m-%d").$Project.tgzif[-f$OldFile]thenrm-f$OldFile>/dev/nullecho"[$OldFile],DeleteOldFileSuccess!">>$LogFilefiecho"">>$LogFiledoneecho"--------------------------------------------------">>$LogFileecho"backupendat$(date+"%Y-%m-%d%H:%M:%S")">>$LogFileecho"">>$LogFileexit0
复制代码
- onu_armonu_voiponu_wifi5xxx7xxx8xxxnms
欢迎光临 仓酷云 (http://www.ckuyun.com/) | Powered by Discuz! X3.2 |