您现在的位置是: 首页 > 运维 LNMP定时备份任务教程(支持排除指定文件夹)
LNMP定时备份任务教程(支持排除指定文件夹)
2020-05-22 【运维】 2634人已围观 4776次浏览
简介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 项目完整部署方案
站长推荐
猜你喜欢
- CentOS 安装JDK
- npm 出现 Unexpected token < in JSON at position 21330
- CentOS 安装Python3
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- Windows CMD 常用命令
- Vue 监听回车 el-input 和 input 使用方法不同
- Docker 批量操作命令
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- 解决443端口被VMWare Workstation占用