您现在的位置是: 首页 > 运维 LNMP定时备份任务教程(支持排除指定文件夹)
LNMP定时备份任务教程(支持排除指定文件夹)
2020-05-22 【运维】 1866人已围观 3707次浏览
简介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)
相关文章
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- linux下各文件夹的结构说明及用途介绍
- SqlServer 刷新所有视图
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- Linux no space left on device 出现设备上没有空间问题
- 在使用Flutter进行网络请求时,使用Dio访问https地址出现unable to get local issuer certificate错误
- Python自动生成和安装requirements.txt文件中的依赖
- 【代码片段】MySQL新建表添加基础字段
- LNMP定时备份任务教程(支持排除指定文件夹)
- SpringBoot 启动提示 Requested bean is currently in creation: Is there an unresolvable circular reference?
- LNMP 手动更新 SSL 证书