ls方式備份腳本


#!/bin/bashbash


Name=`hostname`ide

Date=`date +%Y%m%d`spa

Date2=`date +%Y%m%d -d "30 day ago"`xml


BASE_DIR="/space/hudson/jobs"it

DEST_DIR="/backup1/Hudson_cfgbak/$Name/$Date"class


/bin/mkdir -p /backup1/Hudson_cfgbak/$Name/$Datedate

/bin/rm -rf /backup1/Hudson_cfgbak/$Name/$Date2di


cd ${BASE_DIR}view


for Job in $(ls)vi

do

if [ -d $Job ];then

if [ -f $Job/config.xml ];then

if [ -d "${DEST_DIR}/$Job" ];then

/bin/cp $Job/config.xml ${DEST_DIR}/$Job/

else

mkdir -p ${DEST_DIR}/$Job

/bin/cp $Job/config.xml ${DEST_DIR}/$Job

fi

fi

fi

done 

相關文章
相關標籤/搜索