windows nginx日志切割

@echo off
if not exist "C:\nginx" goto dpan
set nginxpath= C:\nginx
set nd=C:
goto start
:dpan
if not exist "D:\nginx" goto epan
set nginxpath= D:\nginx
set nd=D:
goto start
:epan
if not exist "E:\nginx" goto fpan
set nginxpath= E:\nginx
set nd=E:
goto start
:fpan
if not exist "F:\nginx" goto fpan
set nginxpath= F:\nginx
set nd=F:
goto start
:start
set nlog=%nginxpath%\logs
set nlogbak=%nginxpath%\logbak
if not exist %nlogbak% mkdir %nlogbak%
%nd%
cd %nginxpath%
set cmdstr= move %nlog%\access.log %nlogbak%\access%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.log
taskkill /F /IM nginx.exe
call %cmdstr%
start nginx

你可能感兴趣的:(nginx,windows)