Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Windows nginx log scrolling

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

@ echo off

Rem this script is to complete the Nginx service log scrolling

Rem nginx working directory

Set workspace=D:\ NIIS\ Nginx

Rem log storage directory

Set logdir=D:\ NIIS\ Nginx\ logs

Rem to view the nginx processes running on the system

Rem tasklist / fi "p_w_picpathname eq nginx.exe"

The path where rem logs are stored. The directory structure of the saved log is: year\ month\ day

Set rolldir=%logdir%\% date:~0,4%\% date:~5,2%\% date:~8,2%

Set mdrolldir=md rolldir%

Call mdrolldir%

Rem backup and rename access log files based on time

The naming format of rem log file is: access. Year-month-day-hour. 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 backup and rename error log files based on time

The naming format of rem log file is: access. Year-month-day-hour. 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 reopens the log file

% workspace%\ nginx.exe-s reopen-p% workspace%

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report