ssh自动备份主机文件的脚本
(编辑:jimmy 日期: 2024/11/13 浏览:3 次 )
复制代码 代码如下:
#!/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 "^_^"
然后添加个每日任务就可以了。
#!/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 "^_^"
然后添加个每日任务就可以了。
下一篇:apache中通过mod_rewrite实现伪静态页面的方法