您现在的位置是: 首页 > 运维 LNMP定时备份任务教程(支持排除指定文件夹)
LNMP定时备份任务教程(支持排除指定文件夹)
2020-05-22 【运维】 3082人已围观 5575次浏览
简介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 项目完整部署方案
站长推荐
猜你喜欢
- mybatis中大于等于小于等于的写法
- Docker 批量操作命令
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- CentOS 7 安装 Golang 环境
- SqlServer 刷新所有视图
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- ThinkPHP 解决跨域访问问题
- npm 出现 Unexpected token < in JSON at position 21330
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- Nestedset 出现 Node must exists. 错误解决方案