windows:
1、建一个Bat文件如下。
2、设置定时执行Bat方法
@echo off set basedir=%~dp0 set logdir=%~dp0\logs set dir=%logdir%\backup set nginxSer="Nginx Service" cd basedir net stop %nginxSer% >nul taskkill /F /IM nginx.exe > nul rem date格式:Wed 11/02/2016 set today=%date:~0,4%-%date:~5,2%-%date:~8,2% if not exist "%dir%" md "%dir%" rem access log move "%logdir%\access.log" "%dir%\access-%today%.log" ::start nginx net start %nginxSer% pause