备份数据日期大前天的数据,逐个文件压缩,并删除原有文件
bacak_data.sh 20171120
#!/bin/bash
day_id=$1
yesteday_3=`date -d "${day_id} i -3 day" + '%Y%m%d'`
cd /data/cbus/${yesteday_3}
cbus_path="/data/cbus/${yesteday_3}"
cbus_file=`ls $cbus_path`
for i in $cbus_file
do
tar -zcf $i.tar.gz $i --remove-files
done
bacak_data.sh 20171120
#!/bin/bash
day_id=$1
yesteday_3=`date -d "${day_id} i -3 day" + '%Y%m%d'`
cd /data/cbus/${yesteday_3}
cbus_path="/data/cbus/${yesteday_3}"
cbus_file=`ls $cbus_path`
for i in $cbus_file
do
tar -zcf $i.tar.gz $i --remove-files
done