打包7天內文件,並按照日期生成文件名

#!/bin/bash
export DATE_today=`date +%Y%m%d`
export DATE_7Dago=`date +%Y%m%d -d"7 day ago"`

mv /root/vfpa/fail /root/vfpa/fail_arch/ && mkdir /root/vfpa/fail

tar -Jcf /root/vfpa/fail_arch/zip/new/vfpa_trans_fail_list_$DATE_7Dago-$DATE_today.tar.xz /root/vfpa/fail_arch/fail
rm -rf /root/vfpa/fail_arch/fail



# use crontab -e , define your schedule at every day.

export DATE_new=`date +%m%d%H%M%Y.%S --date="+35 sec"`
date $DATE_newbash

相關文章
相關標籤/搜索