一个windows计划任务的Nginx日志自动截断的批处理命令

net stop nginx

taskkill /im nginx.exe /f

cd E:nginx
e:

set NO=%Date:~0,4%%Date:~5,2%%Date:~8,2%
set t=%Time%
if "%t:~0,1%" ==" " (
set t=0%t:~1%
)
set NO=%Date:~0,4%%Date:~5,2%%Date:~8,2%%t:~0,2%%t:~3,2%%t:~6,2%

move logsaccess.log bakaccess_%no%.log
move logserror.log bakerror_%no%.log
copy nul logsaccess.log
copy nul logserror.log


net start nginx

pause
原文地址:https://www.cnblogs.com/weiweictgu/p/7010876.html