Tomcat备份脚本

#!/bin/bash
#backup.sh
#备份至/usr/local/backdir/
#标识
ServerFlag=137 
#备份存放目录
BackupPath=/usr/local/backdir/
#要备份的目录
DBPath=/usr/local/tomcat/webapps
LastBakPath="$DBPath"-LastBak
DATE=$(date +%y%m%d%H%M%S)
NewFile="$BackupPath""$ServerFlag"webapps"$DATE".tgz
tar -cPzvf $NewFile $DBPath


DelFile="$BackupPath""$ServerFlag"webapps"$(date -d"-2 day" +%y%m%d*)".tgz
rm -f $DelFile

转载于:https://www.cnblogs.com/aallenn/p/6700565.html

你可能感兴趣的:(Tomcat备份脚本)