@echo off
創(chuàng)新互聯(lián)公司專業(yè)成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè),集網(wǎng)站策劃、網(wǎng)站設(shè)計(jì)、網(wǎng)站制作于一體,網(wǎng)站seo、網(wǎng)站優(yōu)化、網(wǎng)站營(yíng)銷、軟文發(fā)稿等專業(yè)人才根據(jù)搜索規(guī)律編程設(shè)計(jì),讓網(wǎng)站在運(yùn)行后,在搜索中有好的表現(xiàn),專業(yè)設(shè)計(jì)制作為您帶來(lái)效益的網(wǎng)站!讓網(wǎng)站建設(shè)為您創(chuàng)造效益。
rem 這個(gè)腳本是為了完成Nginx服務(wù)日志滾動(dòng)
rem nginx工作目錄
set workspace=D:\NIIS\Nginx
rem 日志存放目錄
set logdir=D:\NIIS\Nginx\logs
rem 查看系統(tǒng)中正在運(yùn)行的nginx進(jìn)程
rem tasklist /fi "p_w_picpathname eq nginx.exe"
rem 日志存放路徑。保存日志的目錄結(jié)構(gòu)為:年\月\日
set rolldir=%logdir%\%date:~0,4%\%date:~5,2%\%date:~8,2%
set mdrolldir=md %rolldir%
call %mdrolldir%
rem 備份并根據(jù)時(shí)間重命名訪問(wèn)日志文件
rem 日志文件命名格式為:access.年-月-日-小時(shí).log
set cmdstr=move %logdir%\access.log %rolldir%\access.%date:~0,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%.log
call %cmdstr%
rem 備份并根據(jù)時(shí)間重命名錯(cuò)誤日志文件
rem 日志文件命名格式為:access.年-月-日-小時(shí).log
set cmdstr=move %logdir%\error.log %rolldir%\error.%date:~0,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%.log
call %cmdstr%
rem 重新打開(kāi)日志文件
%workspace%\nginx.exe -s reopen -p %workspace%