[root@localhost rtqserver]# cat data_cp.sh
#!/bin/bash
rtq_data_home=/home/aa/123/data/456
his_home=/home/aa/123/data/history
his_home_sum=`ls $his_home | wc -l`
date_test=`date +%y%m%d`
date_week=`date +%w`
#####################
if [ $his_home_sum -gt 31 ]
then
for state in `ls $his_home`
do
rm -rf $state
break
done
fi
#####################
function minute_bak {
cd $his_home
mkdir $date_test
cd $his_home/$date_test
cp $rtq_data_home/a1.* $his_home/$date_test
cp $rtq_data_home/a2.* $his_home/$date_test
cp $rtq_data_home/a3.* $his_home/$date_test
chown -R koscom:koscom *
}
######################
if [ $date_week -ne 0 ] && [ $date_week -ne 6 ]
then
minute_bak
fi
阅读(2440) | 评论(0) | 转发(0) |