您现在的位置是: 首页 > 运维 LNMP定时备份任务教程(支持排除指定文件夹)
LNMP定时备份任务教程(支持排除指定文件夹)
2020-05-22 【运维】 1206人已围观 2078次浏览
简介LNMP定时备份任务教程(支持排除指定文件夹)
首先是修改定时任务配置,可以参考官网教程
https://lnmp.org/faq/lnmp-1-2-tools.html
安装 cronb ,建立规则(每天凌晨3点执行)
00 03 * * * /lnmp安装路径/tools/backup.sh
排除指定文件夹,比如 PHP 项目的 vender 文件夹
默认配置(文件位置 tools/backup.sh ,大概在 37 行)
Backup_Dir()
{
Backup_Path=$1
Dir_Name=`echo ${Backup_Path##*/}`
Pre_Dir=`echo ${Backup_Path}|sed 's/'${Dir_Name}'//g'`
tar zcf ${Backup_Home}www-${Dir_Name}-$(date +"%Y%m%d").tar.gz -C ${Pre_Dir} ${Dir_Name}
}
主要修改的就是 tar zcf 这一行的内容
tar zcf ${Backup_Home}www-${Dir_Name}-$(date +"%Y%m%d").tar.gz -C ${Pre_Dir} --exclude ${Dir_Name}/vendor ${Dir_Name}
如果有多个文件或文件夹需要排除,则添加多个 --exclude 即可,比如
--exclude ${Dir_Name}/vendor --exclude ${Dir_Name}/node_modules
很赞哦! (0)
相关文章
- Oracle ORA-12541:TNS:no listener错误解决方法
- ElasticSearch安装踩坑指南
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- mysql 索引过长1071-max key length is 767 byte
- mybatis中大于等于小于等于的写法
- docker mysql 导入 SQL 脚本
- CentOS 7 安装 Golang 环境
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- CentOS 安装 Docker
- 解决443端口被VMWare Workstation占用
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- Debian apt 使用国内镜像
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- nuxt 项目完整部署方案
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
站长推荐
猜你喜欢
- 【代码片段】MySQL新建表添加基础字段
- Windows CMD 常用命令
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- 迁移 Docker 目录
- sentinel directive while not in sentinel mode 问题解决
- SpringBoot 启动提示 Requested bean is currently in creation: Is there an unresolvable circular reference?
- Linux 常用命令 持续更新中...
- Mac 设置允许任何来源
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法