#!/bin/bash
cd /home/backup/
echo "---"
echo "delete start:"$(date +'%Y%m%d_%X')
echo " delete..."$(date -d -5day +"%Y%m%d_%H%M")
rm -rf Web_$(date -d -6day +"%Y%m%d")*
echo "delete end:"$(date +'%Y%m%d_%X')
echo "---"
echo "backup start:"$(date +'%Y%m%d_%X')
cp -R /home/www/ Web_$(date +"%Y%m%d_%H%M")
echo "backup end:"$(date +'%Y%m%d_%X')
echo "---"
echo "^_^"
然后添加个每日任务就可以了。
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!