您现在的位置是: 首页 > 运维 LNMP定时备份任务教程(支持排除指定文件夹)
LNMP定时备份任务教程(支持排除指定文件夹)
2020-05-22 【运维】 2532人已围观 4626次浏览
简介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)
相关文章
- CentOS 安装Node.js
- ElasticSearch安装踩坑指南
- Linux no space left on device 出现设备上没有空间问题
- linux下各文件夹的结构说明及用途介绍
- CentOS 7 安装 Golang 环境
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- Linux 服务器之间传输大文件(压缩文件、查看MD5、后台传输)
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- 解决443端口被VMWare Workstation占用
- 迁移 Docker 目录
点击排行
- 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 项目完整部署方案
站长推荐
猜你喜欢
- 常见端口号
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- ElasticSearch安装踩坑指南
- Mac禁用Adobe Creative Cloud自启状态栏
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- CentOS 安装JDK
- Laravel Dingo/api 出现 The version given was unknown or has no registered routes.报错
- Windows CMD 常用命令
- linux下各文件夹的结构说明及用途介绍
- Linux no space left on device 出现设备上没有空间问题