Windows下Nginx日志分割
2016-07-14 19:18
316 查看
@echo off
rem check nginx task list in system
rem tasklist /fi “imagename eq nginx.exe”
rem taskkill /F /IM nginx.exe
rem get time in format
set dst=%date:~6,4%%date:~0,2%%date:~3,2%
rem rename and backup km download log
set “cmdstr=move D:\nginx-1.8.0\logs\svckb_access.log D:\nginx-1.8.0\logs\%dst%svckb_access.log
call %cmdstr%”
rem rename and backup km access log
set “cmdstr=move D:\nginx-1.8.0\logs\svckb_access.log D:\nginx-1.8.0\logs\%dst%svckm_access.log
call %cmdstr%”
rem rename and backup wcf service access log
set “cmdstr=move D:\nginx-1.8.0\logs\st_access.log D:\nginx-1.8.0\logs\%dst%st_access.log
call %cmdstr%”
rem rename and backup error log
set “cmdstr=move D:\nginx-1.8.0\logs\error.log D:\nginx-1.8.0\logs\%dst%error.log
call %cmdstr%”
rem delete log in 7 days before
forfiles /p “D:\nginx-1.8.0\logs” /s /m *.log /d -7 /c “cmd /c del @path”
rem re-opening log files
nginx -s reopen
echo on
Notice:
date format may be different in each system
rem check nginx task list in system
rem tasklist /fi “imagename eq nginx.exe”
rem taskkill /F /IM nginx.exe
rem get time in format
set dst=%date:~6,4%%date:~0,2%%date:~3,2%
rem rename and backup km download log
set “cmdstr=move D:\nginx-1.8.0\logs\svckb_access.log D:\nginx-1.8.0\logs\%dst%svckb_access.log
call %cmdstr%”
rem rename and backup km access log
set “cmdstr=move D:\nginx-1.8.0\logs\svckb_access.log D:\nginx-1.8.0\logs\%dst%svckm_access.log
call %cmdstr%”
rem rename and backup wcf service access log
set “cmdstr=move D:\nginx-1.8.0\logs\st_access.log D:\nginx-1.8.0\logs\%dst%st_access.log
call %cmdstr%”
rem rename and backup error log
set “cmdstr=move D:\nginx-1.8.0\logs\error.log D:\nginx-1.8.0\logs\%dst%error.log
call %cmdstr%”
rem delete log in 7 days before
forfiles /p “D:\nginx-1.8.0\logs” /s /m *.log /d -7 /c “cmd /c del @path”
rem re-opening log files
nginx -s reopen
echo on
Notice:
date format may be different in each system
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误
- 基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS