# ngx_logrotate **Repository Path**: 3092/ngx_logrotate ## Basic Information - **Project Name**: ngx_logrotate - **Description**: NGINX 日志切割脚本 - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-03-26 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ngx_logrotate #### 介绍 NGINX 日志切割脚本 #### 软件架构 软件架构说明   ngx_rotate.sh 脚本使用 locate 命令来搜索 nginx 命令所在位置,过滤关键字为“sbin/nginx",为避免 NGINX 程序更新时产生的备份文件也出现在搜索结果中,在过滤条件中加入”$“符号,判断以”sbin/nginx“结尾,即过滤”sbin/nginx“结尾的文件。   当 NGINX 存在多个 vhost 时,为了将相同域名(项目)的日志集中存放在同一个目录中,在备份目录中按照域名创建对应的子目录,然后再将日志以前一天的日期最为文件名压缩至对应子目录。 #### 安装教程 1. 各 install.sh 文件赋予执行权限 chmod +x install.sh 2. 运行安装脚本 ./install.sh 3. 使用 bash 命令可以在不添加权限的情况下直接执行脚本 bash install.sh #### 使用说明 1. ngx_rotate.sh 为日志切割的主要脚本文件,install.sh 可以省去手动拷贝文件、手动挡添加计划任务的工作。 2. ngx_rotate.sh 文件默认被拷贝到 /usr/local/bin 目录,切割任务是每天0点执行。 #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)