#!/bin/bash
Name=`hostname`
Date=`date +%Y%m%d`
Date2=`date +%Y%m%d -d "30 day ago"`
BASE_DIR="/space/hudson/jobs"
DEST_DIR="/backup1/Hudson_cfgbak/$Name/$Date"
/bin/mkdir -p /backup1/Hudson_cfgbak/$Name/$Date
/bin/rm -rf /backup1/Hudson_cfgbak/$Name/$Date2
cd ${BASE_DIR}
for Job in $(ls)
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
时间: 2024-10-10 23:11:28